Cannot Update Short Headline for Responsive Display Ad

73 views
Skip to first unread message

syam...@synchroweb.com

unread,
Mar 8, 2018, 5:46:16 AM3/8/18
to AdWords API Forum
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>



Dhanya Sundararaju (AdWords API Team)

unread,
Mar 8, 2018, 12:51:04 PM3/8/18
to AdWords API Forum
Hi,

The error you are getting is because we cannot modify attributes other than status of the ad. Please refer this section of guide for better clarity. However, you can create a new Ad with the desired description and pause or remove the current Ad. Please let me know if you have further questions.

Regards,
Dhanya, AdWords API Team
Reply all
Reply to author
Forward
0 new messages