CampaignCriterion for Location: [CampaignCriterionError.CONCRETE_TYPE_REQUIRED @ operations[0].operand.criterion]

110 views
Skip to first unread message

Dmitry Omelyusik

unread,
Oct 31, 2019, 11:29:50 AM10/31/19
to AdWords API and Google Ads API Forum
I've posted the provided XML to the CampaignCriterionService and expected, that I'll add a location to the campaign.
    <s11:Header>
        <ns1:RequestHeader xmlns:ns1="https://adwords.google.com/api/adwords/cm/v201809">
            <ns1:clientCustomerId>myID</ns1:clientCustomerId>
            <ns1:developerToken>myToken</ns1:developerToken>
            <ns1:userAgent></ns1:userAgent>
            <ns1:validateOnly></ns1:validateOnly>
            <ns1:partialFailure></ns1:partialFailure>
        </ns1:RequestHeader>
    </s11:Header>
    <s11:Body>
        <ns1:mutate xmlns:ns1="https://adwords.google.com/api/adwords/cm/v201809">
            <ns1:operations>
                <ns1:operator>ADD</ns1:operator>
                <ns1:Operation.Type></ns1:Operation.Type>
                <ns1:operand>
                    <ns1:campaignId>7841550604</ns1:campaignId>
                    <ns1:criterion>
                        <ns1:id>1002624</ns1:id>
                        <ns1:type>LOCATION</ns1:type>
                        <ns1:Criterion.Type>LOCATION</ns1:Criterion.Type>
                    </ns1:criterion>
                </ns1:operand>
            </ns1:operations>
        </ns1:mutate>
    </s11:Body>
</s11:Envelope>

Unfortunately, I've got the provided response:

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
    <soap:Header>
        <ResponseHeader xmlns="https://adwords.google.com/api/adwords/cm/v201809">
            <requestId>000596366ca5a1cd0ac7c2c4370d94c7</requestId>
            <serviceName>CampaignCriterionService</serviceName>
            <methodName>mutate</methodName>
            <operations>1</operations>
            <responseTime>126</responseTime>
        </ResponseHeader>
    </soap:Header>
    <soap:Body>
        <soap:Fault>
            <faultcode>soap:Client</faultcode>
            <faultstring>[CampaignCriterionError.CONCRETE_TYPE_REQUIRED @ operations[0].operand.criterion]</faultstring>
            <detail>
                <ApiExceptionFault xmlns="https://adwords.google.com/api/adwords/cm/v201809">
                    <message>[CampaignCriterionError.CONCRETE_TYPE_REQUIRED @ operations[0].operand.criterion]</message>
                    <ApplicationException.Type>ApiException</ApplicationException.Type>
                    <errors xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="CampaignCriterionError">
                        <fieldPath>operations[0].operand.criterion</fieldPath>
                        <fieldPathElements>
                            <field>operations</field>
                            <index>0</index>
                        </fieldPathElements>
                        <fieldPathElements>
                            <field>operand</field>
                        </fieldPathElements>
                        <fieldPathElements>
                            <field>criterion</field>
                        </fieldPathElements>
                        <trigger></trigger>
                        <errorString>CampaignCriterionError.CONCRETE_TYPE_REQUIRED</errorString>
                        <ApiError.Type>CampaignCriterionError</ApiError.Type>
                        <reason>CONCRETE_TYPE_REQUIRED</reason>
                    </errors>
                </ApiExceptionFault>
            </detail>
        </soap:Fault>
    </soap:Body>
</soap:Envelope>

I know, that operand.criterion.type is the extra field, but without it, the same response also is returned. 

Dmitry Omelyusik

unread,
Oct 31, 2019, 11:48:35 AM10/31/19
to AdWords API and Google Ads API Forum

I’m looking for assistance with some adwords API integration work I am doing. Here is the background:

  • I’m creating a campaing the needs to have location targetting with proximity (25 mile radius)
  • I’m writing our code in go against the API directly (no sdk)

I am able to first create the campaing no problem and get the campaignID back.

I then want to set location targeting (city, state) and apply a radius of 25 miles. When I do this step I’m getting an error I can’t explain or get around, I’ve posted the code below.

So two questions.

  1. Is this the best way to do this operation (I’m open to ideas on a more effecitent way to create a campaign with location and proximity targetting.
  2. If not can someone help me identify the issue with my code?

Google Ads API Forum Advisor Prod

unread,
Oct 31, 2019, 12:52:06 PM10/31/19
to adwor...@googlegroups.com

Hi Dmitry,

 

Thank you for reaching out. The CampaignCriterionError.CONCRETE_TYPE_REQUIRED error usually occurs when you are not specifying the type of criterion to mutate. This doesn't seem to be the case here but based on your logs, it looks like you are missing some fields in your request. You can use this example (in the language you are using) to add location criteria to your campaign. If that doesn't work, please provide the complete SOAP logs for that request so that I can investigate further.

 

Regards,

Mitchell

Google Ads API Team



ref:_00D1U1174p._5001UKPBLZ:ref

Dmitry Omelyusik

unread,
Oct 31, 2019, 2:33:39 PM10/31/19
to AdWords API and Google Ads API Forum
Hi there
Thanks for answer

As I've written, I'm writing on Go. Google does not provide any official Google AdWords library for Go, so I have to deal with HTTP requests to https://adwords.google.com/api/adwords/cm/v201809/. And XML objects are made by marshalling native structs to the XML and it's all logs that I have.

I create objects based on https://developers.google.com/adwords/api/docs/reference/v201809/CampaignCriterionService.Location and https://adwords.google.com/api/adwords/cm/v201809/CampaignCriterionService?wsdl.
I didn't find any information about extra fields to the criterion object I should add and how to form it with those fields.

It is nice if you have some example with already filled XML object for campaign criterion to set location targeting.

Hope, you have :)

Google Ads API Forum Advisor Prod

unread,
Oct 31, 2019, 3:05:42 PM10/31/19
to adwor...@googlegroups.com

Hi Dmitry,

 

I'm attaching the XML of my working request. Is this what you are looking for?

xml_request.txt

Dmitry Omelyusik

unread,
Oct 31, 2019, 4:08:27 PM10/31/19
to AdWords API and Google Ads API Forum
Yes, great!

Thanks!

Reply all
Reply to author
Forward
0 new messages