Unable to create CriterionUserList - Adwords API

23 views
Skip to first unread message

Sanjay Hallan

unread,
Jul 2, 2019, 6:41:06 AM7/2/19
to adwor...@googlegroups.com
Hi,

I am trying to create a CampaignCriterion via the Google Adwords API but it is failing asking for a criterion.id (but this is the thing I am trying to create) so a little confused.

Could someone please advise?

SOAP logs:

requests 11:32:30 DEBUG| Making request: POST https://accounts.google.com/o/oauth2/token
connectionpool 11:32:30 DEBUG| Starting new HTTPS connection (1): accounts.google.com:443
connectionpool 11:32:30 DEBUG| https://accounts.google.com:443 "POST /o/oauth2/token HTTP/1.1" 200 None
util 11:32:30 INFO| Request made: Service: "CampaignCriterionService" Method: "mutate" URL: "https://adwords.google.com/api/adwords/cm/v201809/CampaignCriterionService"
util 11:32:30 DEBUG| Outgoing request: {'SOAPAction': '""', 'Content-Type': 'text/xml; charset=utf-8', 'authorization': 'REDACTED'}
<soap-env:Envelope xmlns:soap-env="http://schemas.xmlsoap.org/soap/envelope/">
  <soap-env:Header>
    <ns0:RequestHeader xmlns:ns0="https://adwords.google.com/api/adwords/cm/v201809">
      <ns0:clientCustomerId>THE_CLIENTCUSTOMERID</ns0:clientCustomerId>
      <ns0:developerToken>REDACTED</ns0:developerToken>
      <ns0:userAgent>AdWordsClient/201809.0.1.0-dev (AwApi-Python, googleads/20.0.0, Python/3.7.0, zeep)</ns0:userAgent>
      <ns0:validateOnly>false</ns0:validateOnly>
      <ns0:partialFailure>false</ns0:partialFailure>
    </ns0:RequestHeader>
  </soap-env:Header>
  <soap-env:Body>
    <ns0:mutate xmlns:ns0="https://adwords.google.com/api/adwords/cm/v201809">
      <ns0:operations xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ns0:CampaignCriterionOperation">
        <ns0:operator>SET</ns0:operator>
        <ns0:operand>
          <ns0:campaignId>CAMPAIGN_ID</ns0:campaignId>
          <ns0:criterion xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ns0:CriterionUserList">
            <ns0:userListId>USERLIST_ID</ns0:userListId>
          </ns0:criterion>
          <ns0:bidModifier>0.5</ns0:bidModifier>
        </ns0:operand>
      </ns0:operations>
    </ns0:mutate>
  </soap-env:Body>
</soap-env:Envelope>

connectionpool 11:32:30 DEBUG| Starting new HTTPS connection (1): adwords.google.com:443
connectionpool 11:32:30 DEBUG| https://adwords.google.com:443 "POST /api/adwords/cm/v201809/CampaignCriterionService HTTP/1.1" 500 None
util 11:32:30 DEBUG| Incoming response:
b'<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">\n  <soap:Header>\n    <ResponseHeader xmlns="https://adwords.google.com/api/adwords/cm/v201809">\n      <requestId>00058cb04309cc7e0a379a177b00448b</requestId>\n      <serviceName>CampaignCriterionService</serviceName>\n      <methodName>mutate</methodName>\n      <operations>1</operations>\n      <responseTime>72</responseTime>\n    </ResponseHeader>\n  </soap:Header>\n  <soap:Body>\n    <soap:Fault>\n      <faultcode>soap:Client</faultcode>\n      <faultstring>[RequiredError.REQUIRED @ operations[0].operand.criterion.id]</faultstring>\n      <detail>\n        <ApiExceptionFault xmlns="https://adwords.google.com/api/adwords/cm/v201809">\n          <message>[RequiredError.REQUIRED @ operations[0].operand.criterion.id]</message>\n          <ApplicationException.Type>ApiException</ApplicationException.Type>\n          <errors xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="RequiredError">\n            <fieldPath>operations[0].operand.criterion.id</fieldPath>\n            <fieldPathElements>\n              <field>operations</field>\n              <index>0</index>\n            </fieldPathElements>\n            <fieldPathElements>\n              <field>operand</field>\n            </fieldPathElements>\n            <fieldPathElements>\n              <field>criterion</field>\n            </fieldPathElements>\n            <fieldPathElements>\n              <field>id</field>\n            </fieldPathElements>\n            <trigger/>\n            <errorString>RequiredError.REQUIRED</errorString>\n            <ApiError.Type>RequiredError</ApiError.Type>\n            <reason>REQUIRED</reason>\n          </errors>\n        </ApiExceptionFault>\n      </detail>\n    </soap:Fault>\n  </soap:Body>\n</soap:Envelope>\n'
util 11:32:30 WARNING| Error summary: {'faultMessage': '[RequiredError.REQUIRED @ operations[0].operand.criterion.id]', 'requestId': '00058cb04309cc7e0a379a177b00448b', 'serviceName': 'CampaignCriterionService', 'methodName': 'mutate', 'operations': '1', 'responseTime': '72'}

Thanks
Sanjay

Google Ads API Forum Advisor Prod

unread,
Jul 3, 2019, 2:15:58 AM7/3/19
to adwor...@googlegroups.com
Hi Sanjay,

I had to edit your initial post as it contains sensitive information regarding your account. You may check out our forum posting guidelines to avoid exposing such information.

Moving forward, it appears that you are using the SET operator when creating the CampaignCriterion. Could you use the ADD operator instead and retry your request? For SET requests, the ID would be required as it is used for updating entities.

Thanks and regards,
Peter
Google Ads API Team

ref:_00D1U1174p._5001UCaaxD:ref
Reply all
Reply to author
Forward
0 new messages