Hi,
Could you please help me to add a new operating system version target to a particular campaign or adgroup? I am able to add other targeting options but not operating system version.
I am using Java API. I am trying to add OperatingSystemVersion programmatically like below, assume that I set all other campaign properties,
OperatingSystemVersion osv = new OperatingSystemVersion();
osv.setId(630153L);
CampaignCriterion c = new CampaignCriterion();
c.setCriterion(osv);
campaignCriteria.add(c);
Following is the SOAP request,
<soapenv:Body>
<mutate xmlns="
https://adwords.google.com/api/adwords/cm/v201809">
<operations>
<operator>ADD</operator>
<operand>
<campaignId>
2047907271</campaignId>
<criterion xmlns:ns2="
https://adwords.google.com/api/adwords/cm/v201809" xsi:type="ns2:Language">
<ns2:id>1000</ns2:id>
<ns2:code>en</ns2:code>
<ns2:name>English</ns2:name>
</criterion>
<campaignCriterionStatus>ACTIVE</campaignCriterionStatus>
</operand>
</operations>
<operations>
<operator>ADD</operator>
<operand>
<campaignId>2047907271</campaignId>
<criterion xmlns:ns3="https://adwords.google.com/api/adwords/cm/v201809" xsi:type="ns3:OperatingSystemVersion">
<ns3:id>630153</ns3:id>
<ns3:name>Apple iOS</ns3:name>
</criterion>
<campaignCriterionStatus>ACTIVE</campaignCriterionStatus>
</operand>
</operations> <operations>
<operator>ADD</operator>
<operand>
<campaignId>
2047907271</campaignId>
<criterion xmlns:ns4="
https://adwords.google.com/api/adwords/cm/v201809" xsi:type="ns4:Language">
<ns4:id>1102</ns4:id>
<ns4:code>ms</ns4:code>
<ns4:name>Malay</ns4:name>
</criterion>
<campaignCriterionStatus>ACTIVE</campaignCriterionStatus>
</operand>
</operations>
</mutate>
</soapenv:Body>
I am getting the following error,
<soap:Envelope xmlns:soap="
http://schemas.xmlsoap.org/soap/envelope/">
<soap:Header>
<ResponseHeader xmlns="
https://adwords.google.com/api/adwords/cm/v201809">
<requestId>00058c5ecddabd3c0a620013310b20cb</requestId>
<serviceName>CampaignCriterionService</serviceName>
<methodName>mutate</methodName>
<operations>12</operations>
<responseTime>279</responseTime>
</ResponseHeader>
</soap:Header>
<soap:Body>
<soap:Fault>
<faultcode>soap:Client</faultcode>
<faultstring>[OperationAccessDenied.OPERATION_NOT_PERMITTED_FOR_CAMPAIGN_TYPE @ operations[1].operand.criterion; trigger:'SEARCH']</faultstring>
<detail>
<ApiExceptionFault xmlns="
https://adwords.google.com/api/adwords/cm/v201809">
<message>[OperationAccessDenied.OPERATION_NOT_PERMITTED_FOR_CAMPAIGN_TYPE @ operations[1].operand.criterion; trigger:'SEARCH']</message>
<ApplicationException.Type>ApiException</ApplicationException.Type>
<errors xmlns:xsi="
http://www.w3.org/2001/XMLSchema-instance" xsi:type="OperationAccessDenied">
<fieldPath>operations[1].operand.criterion</fieldPath>
<fieldPathElements>
<field>operations</field>
<index>1</index>
</fieldPathElements>
<fieldPathElements>
<field>operand</field>
</fieldPathElements>
<fieldPathElements>
<field>criterion</field>
</fieldPathElements>
<trigger>SEARCH</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>
The above error was thrown only if I add operatingsystemversion as one of the operation, other options are working fine. Please provide some java code to add operatingsytemversion to campaign or adgroup.
Suresh