<?xml version="1.0" encoding="UTF-8" standalone="no"?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <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> <mutate xmlns="https://adwords.google.com/api/adwords/cm/v201809"> <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><?xml version="1.0" encoding="UTF-8" standalone="no"?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <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> <mutate xmlns="https://adwords.google.com/api/adwords/cm/v201809"> <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>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
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}
@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});
}