I want to update the Short Headline of my ad by doing this code.
$adgroupid = 567567;
$xid = 346346;
$adWordsServices = new AdWordsServices();
$currentService = $adWordsServices->get($this->aw_session,
AdGroupAdService::class);
$operations = [];
$ad = new ResponsiveDisplayAd();
$ad->setId($xid);
$ad->setShortHeadline("New Short Headline Updated");
// Create ad group ad.
$adGroupAd = new AdGroupAd();
$adGroupAd->setAdGroupId($adgroupid);
$adGroupAd->setAd($ad);
// Update the status to PAUSED.
$adGroupAd->setStatus(AdGroupAdStatus::PAUSED);
// Create ad group ad operation and add it to the list.
$operation = new AdGroupAdOperation();
$operation->setOperand($adGroupAd);
$operation->setOperator(Operator::SET);
$operations[] = $operation;
// Pause the ad on the server.
$result = $currentService->mutate($operations);
got this error:
AdError.CANNOT_USE_AD_SUBCLASS_FOR_OPERATOR
this is the full soap message:
HTTP/1.1 500 Internal Server Error
Content-Type: text/xml; charset=UTF-8
Date: Thu, 08 Mar 2018 07:24:56 GMT
Expires: Thu, 08 Mar 2018 07:24:56 GMT
Cache-Control: private, max-age=0
X-Content-Type-Options: nosniff
X-Frame-Options: SAMEORIGIN
X-XSS-Protection: 1; mode=block
Server: GSE
Alt-Svc: hq=":443"; ma=2592000; quic=51303431; quic=51303339;
quic=51303335,quic=":443"; ma=2592000; v="41,39,35"
Accept-Ranges: none
Vary: Accept-Encoding
Connection: close
<soap:Envelope
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Header><ResponseHeader
xmlns="https://adwords.google.com/api/adwords/cm/v201710"><requestId>000566e19293c5d00a621747e70bb148</requestId><serviceName>AdGroupAdService</serviceName><methodName>mutate</methodName><operations>1</operations><responseTime>199</responseTime></ResponseHeader></soap:Header><soap:Body><soap:Fault><faultcode>soap:Client</faultcode><faultstring>[AdError.CANNOT_USE_AD_SUBCLASS_FOR_OPERATOR
@ operations[0].operand.ad]</faultstring><detail><ApiExceptionFault
xmlns="https://adwords.google.com/api/adwords/cm/v201710"><message>[AdError.CANNOT_USE_AD_SUBCLASS_FOR_OPERATOR
@
operations[0].operand.ad]</message><ApplicationException.Type>ApiException</ApplicationException.Type><errors
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:type="AdError"><fieldPath>operations[0].operand.ad</fieldPath><fieldPathElements><field>operations</field><index>0</index></fieldPathElements><fieldPathElements><field>operand</field></fieldPathElements><fieldPathElements><field>ad</field></fieldPathElements><trigger></trigger><errorString>AdError.CANNOT_USE_AD_SUBCLASS_FOR_OPERATOR</errorString><ApiError.Type>AdError</ApiError.Type><reason>CANNOT_USE_AD_SUBCLASS_FOR_OPERATOR</reason></errors></ApiExceptionFault></detail></soap:Fault></soap:Body></soap:Envelope>
--
--
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog and Google+:
https://googleadsdeveloper.blogspot.com/
https://plus.google.com/+GoogleAdsDevelopers/posts
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
You received this message because you are subscribed to the Google
Groups "AdWords API Forum" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/adwords-api?hl=en
---
You received this message because you are subscribed to the Google Groups
"AdWords API Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
Visit this group at https://groups.google.com/group/adwords-api.
To view this discussion on the web visit
https://groups.google.com/d/msgid/adwords-api/d770856c-31e6-4aa1-a9f6-969e94885314%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.