How to modify the title, descriptions, images of an UniversalAppAd

55 views
Skip to first unread message

st4rlight

unread,
May 12, 2020, 8:40:06 AM5/12/20
to AdWords API and Google Ads API Forum
Hi.

I have created an AppCampaign, and an AdGroup with an UniversalAppAd.

And now I want to modify the title, descriptions of UniversalAppAd vid AdWords API, but I got the error_msg  "OperationAccessDenied.OPERATION_NOT_PERMITTED_FOR_CAMPAIGN_TYPE"

The documentation says that the Ad can't be modified but create a new and delete the old one instead,  but when I try to remove it by Operator.REMOVE, I got the same error_msg.


The only way I think is to remove the AdGroup, and create a new one with new UniversalAppAd, it works but I lose my data of previous Ad, such as the click-times


I notice that the web page of Google Ads can modify the attribute of an Ad, I want to know how can I do with the AdWords API


Thanks for your  help!

st4rlight

unread,
May 12, 2020, 8:46:53 AM5/12/20
to AdWords API and Google Ads API Forum


maybe this picture is useful.


the campaign type is an AppCampaign

st4rlight

unread,
May 12, 2020, 8:55:57 AM5/12/20
to AdWords API and Google Ads API Forum
when I use Operator.SET


<?xml version="1.0" encoding="UTF-8" standalone="no"?>
    <soapenv:Header>
        <ns1:RequestHeader xmlns:ns1="https://adwords.google.com/api/adwords/cm/v201809" soapenv:mustUnderstand="0">
            <ns1:clientCustomerId>538-310-7482</ns1:clientCustomerId>
            <ns1:developerToken>REDACTED</ns1:developerToken>
            <ns1:userAgent>HUYA PTE.LTD (AwApi-Java, AdWords-Axis/4.9.1, Common-Java/4.9.1, Axis/1.4, Java/1.8.0_251, maven)</ns1:userAgent>
            <ns1:validateOnly>false</ns1:validateOnly>
            <ns1:partialFailure>false</ns1:partialFailure>
        </ns1:RequestHeader>
    </soapenv:Header>
    <soapenv:Body>
            <operations>
                <operator>SET</operator>
                <operand>
                    <adGroupId>106842473651</adGroupId>
                    <ad xmlns:ns2="https://adwords.google.com/api/adwords/cm/v201809" xsi:type="ns2:UniversalAppAd">
                        <ns2:id>435120021537</ns2:id>
                        <ns2:headlines>
                            <ns2:asset xsi:type="ns2:TextAsset">
                                <ns2:assetText>new Title 1</ns2:assetText>
                            </ns2:asset>
                        </ns2:headlines>
                        <ns2:headlines>
                            <ns2:asset xsi:type="ns2:TextAsset">
                                <ns2:assetText>new Title 2</ns2:assetText>
                            </ns2:asset>
                        </ns2:headlines>
                        <ns2:descriptions>
                            <ns2:asset xsi:type="ns2:TextAsset">
                                <ns2:assetText>new desc</ns2:assetText>
                            </ns2:asset>
                        </ns2:descriptions>
                    </ad>
                    <status>ENABLED</status>
                </operand>
            </operations>
        </mutate>
    </soapenv:Body>
</soapenv:Envelope>

2020-05-12 20:53:29.141 INFO   [thread:main,pid:PID_IS_UNDEFINED] com.google.api.ads.adwords.lib.client.AdWordsServiceClient.soapXmlLogger --- SOAP response:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
    <soap:Header>
        <ResponseHeader xmlns="https://adwords.google.com/api/adwords/cm/v201809">
            <requestId>0005a572f3c393cc0a62cfc47b04a8a2</requestId>
            <serviceName>AdGroupAdService</serviceName>
            <methodName>mutate</methodName>
            <operations>1</operations>
            <responseTime>251</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/v201809">
                    <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/>
                        <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>





when I use Operator.REMOVE
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
    <soapenv:Header>
        <ns1:RequestHeader xmlns:ns1="https://adwords.google.com/api/adwords/cm/v201809" soapenv:mustUnderstand="0">
            <ns1:clientCustomerId>538-310-7482</ns1:clientCustomerId>
            <ns1:developerToken>REDACTED</ns1:developerToken>
            <ns1:userAgent>HUYA PTE.LTD (AwApi-Java, AdWords-Axis/4.9.1, Common-Java/4.9.1, Axis/1.4, Java/1.8.0_251, maven)</ns1:userAgent>
            <ns1:validateOnly>false</ns1:validateOnly>
            <ns1:partialFailure>false</ns1:partialFailure>
        </ns1:RequestHeader>
    </soapenv:Header>
    <soapenv:Body>
            <operations>
                <operator>REMOVE</operator>
                <operand>
                    <adGroupId>106842473651</adGroupId>
                    <ad xmlns:ns2="https://adwords.google.com/api/adwords/cm/v201809" xsi:type="ns2:UniversalAppAd">
                        <ns2:id>435120021537</ns2:id>
                    </ad>
                </operand>
            </operations>
        </mutate>
    </soapenv:Body>
</soapenv:Envelope>

2020-05-12 20:55:18.248 INFO   [thread:main,pid:PID_IS_UNDEFINED] com.google.api.ads.adwords.lib.client.AdWordsServiceClient.soapXmlLogger --- SOAP response:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
    <soap:Header>
        <ResponseHeader xmlns="https://adwords.google.com/api/adwords/cm/v201809">
            <requestId>0005a572fa3eeab50aa79406800d6ce0</requestId>
            <serviceName>AdGroupAdService</serviceName>
            <methodName>mutate</methodName>
            <operations>1</operations>
            <responseTime>613</responseTime>
        </ResponseHeader>
    </soap:Header>
    <soap:Body>
        <soap:Fault>
            <faultcode>soap:Client</faultcode>
            <faultstring>[OperationAccessDenied.OPERATION_NOT_PERMITTED_FOR_CAMPAIGN_TYPE @ operations[0].operand.ad]</faultstring>
            <detail>
                <ApiExceptionFault xmlns="https://adwords.google.com/api/adwords/cm/v201809">
                    <message>[OperationAccessDenied.OPERATION_NOT_PERMITTED_FOR_CAMPAIGN_TYPE @ operations[0].operand.ad]</message>
                    <ApplicationException.Type>ApiException</ApplicationException.Type>
                    <errors xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="OperationAccessDenied">
                        <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/>
                        <errorString>OperationAccessDenied.OPERATION_NOT_PERMITTED_FOR_CAMPAIGN_TYPE</errorString>
                        <ApiError.Type>OperationAccessDenied</ApiError.Type>
                        <reason>OPERATION_NOT_PERMITTED_FOR_CAMPAIGN_TYPE</reason>
                    </errors>
                </ApiExceptionFault>
            </detail>
        </soap:Fault>
    </soap:Body>
</soap:Envelope>


Google Ads API Forum Advisor Prod

unread,
May 12, 2020, 2:51:55 PM5/12/20
to summer.s...@gmail.com, adwor...@googlegroups.com

Hi,

Thank you for reaching out. AdGroupAdService could only be used to mutate the ad status. AdService could be used to muate certain ad types and you could find them in this list. Unfortunately, the UniversalAppAd is not mutable via AdService. Let me know if you have any further questions.

Thanks and regards,
Xiaoming, Google Ads API Team



 

ref:_00D1U1174p._5004Q1zLUEk:ref

st4rlight

unread,
May 12, 2020, 9:55:33 PM5/12/20
to AdWords API and Google Ads API Forum
Thanks for your help.

I retrieved my ad back, the info is

AdGroupAd{ad=UniversalAppAd{adType=UniversalAppAd, headlines=[AssetLink{asset=TextAsset{assetId=8833531363, assetSubtype=TEXT, assetText=1, assetType=TextAsset}, assetPerformanceLabel=PENDING, assetPolicySummaryInfo=AssetPolicySummaryInfo{combinedApprovalStatus=UNDER_REVIEW, policySummaryInfoType=AssetPolicySummaryInfo, reviewState=REVIEW_IN_PROGRESS}}, AssetLink{asset=TextAsset{assetId=8833531366, assetSubtype=TEXT, assetText=2, assetType=TextAsset}, assetPerformanceLabel=PENDING, assetPolicySummaryInfo=AssetPolicySummaryInfo{combinedApprovalStatus=UNDER_REVIEW, policySummaryInfoType=AssetPolicySummaryInfo, reviewState=REVIEW_IN_PROGRESS}}], id=435292008626, type=UNIVERSAL_APP_AD}, adGroupId=102856790044, status=ENABLED}

It's an UniversalAppAd which I created on the website of Google Ads

And I can modify it on the website.

Does it mean that I can't modify it via AdWords API, but via the website manually?

st4rlight

unread,
May 12, 2020, 11:48:33 PM5/12/20
to AdWords API and Google Ads API Forum
I have fixed this problem by AdService, even though the UniversalAppAd doesn't in this list

I don't know why it works, but it works. (-:

Maybe it's about the priority of my Access Token, I have just changed it from test access priory to basic access priority.


follows the code, maybe help for others

@Test
public void testAdModify() throws RemoteException{
Long adId = 1L; // your ad ID here

AdServiceInterface adServiceInterface =
adWordsServices.get(session, AdServiceInterface.class);

UniversalAppAd universalAppAd = new UniversalAppAd();
universalAppAd.setId(adId);

TextAsset titleAsset1 = new TextAsset();
titleAsset1.setAssetText("new Title 1");
TextAsset titleAsset2 = new TextAsset();
titleAsset2.setAssetText("new Title 2");
TextAsset descAsset = new TextAsset();
descAsset.setAssetText("new Description");

AssetLink titleLink1 = new AssetLink();
titleLink1.setAsset(titleAsset1);
AssetLink titleLink2 = new AssetLink();
titleLink2.setAsset(titleAsset2);
AssetLink descLink = new AssetLink();
descLink.setAsset(descAsset);

universalAppAd.setHeadlines(new AssetLink[]{titleLink1, titleLink2});
universalAppAd.setDescriptions(new AssetLink[]{descLink});


AdOperation adOperation = new AdOperation();
adOperation.setOperand(universalAppAd);
adOperation.setOperator(Operator.SET);

adServiceInterface.mutate(new AdOperation[]{adOperation});
}



Reply all
Reply to author
Forward
0 new messages