Unable to create IpBlock criterion, CONCRETE_TYPE_REQUIRED error

143 views
Skip to first unread message

Miloš Đekić

unread,
Nov 30, 2016, 4:48:16 PM11/30/16
to AdWords API Forum
Hi,

I am trying to block an IP address for a campaign with the latest API version (v201607). 

Since I'm coding in NodeJS I'm using an unsupported library:

This is the XML generated by the library as it's sent to the API:

<?xml version="1.0" encoding="UTF-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:jaxb="http://java.sun.com/xml/ns/jaxb" xmlns:tns="https://adwords.google.com/api/adwords/cm/v201609" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soap:Header>
<ns1:RequestHeader xmlns:ns1="https://adwords.google.com/api/adwords/cm/v201609" xmlns="https://adwords.google.com/api/adwords/cm/v201609">
<ns1:developerToken>*************</ns1:developerToken>
<ns1:userAgent>*************</ns1:userAgent>
<ns1:validateOnly>false</ns1:validateOnly>
<ns1:clientCustomerId>*************</ns1:clientCustomerId>
</ns1:RequestHeader>
</soap:Header>
<soap:Body>
<mutate xmlns="https://adwords.google.com/api/adwords/cm/v201609">
<operations>
<operator>ADD</operator>
<operand>
<campaignId>*************</campaignId>
<isNegative>true</isNegative>
<criterion>
<id>1</id>
<type>IP_BLOCK</type>
<Criterion.Type>IpBlock</Criterion.Type>
</criterion>
<CampaignCriterion.Type>NegativeCampaignCriterion</CampaignCriterion.Type>
</operand>
</operations>
</mutate>
</soap:Body>
</soap:Envelope>

I am getting the following error:

CampaignCriterionError.CONCRETE_TYPE_REQUIRED @ operations[0].operand.criterion

I am relying on the the following docs:

CampaignCriterionService | mutate
CampaignCriterionOperation
CampaignCriterion
Criterion\IpBlock

What am I missing here? Where do I have to specify a concrete type other than what I already did. Not to mention that the docs really state that most of these fields will be ignored but I've been trying to get the thing working in any way possible and I've ran out of options.

I would appreciate any help at this point. Thanks!

Anthony Madrigal

unread,
Nov 30, 2016, 5:32:34 PM11/30/16
to AdWords API Forum
Hi Miloš,

You will need to create an IpBlock object then set its ipAddress. Then you can set the criterion of the NegativeCampaignCriterion object to the IpBlock you created. 

Your SOAP request should look like this: 
<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/v201609" soapenv:mustUnderstand="0">
           
<ns1:clientCustomerId>XXXXXX</ns1:clientCustomerId>
           
<ns1:developerToken>REDACTED</ns1:developerToken>
           
<ns1:userAgent>XXXXXX</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/v201609">
           
<operations>
               
<operator>ADD</operator>

               
<operand xmlns:ns2="https://adwords.google.com/api/adwords/cm/v201609" xsi:type="ns2:NegativeCampaignCriterion">
                   
<ns2:campaignId>XXXXX</ns2:campaignId>
                   
<ns2:criterion xsi:type="ns2:IpBlock">
                       
<ns2:ipAddress>1.2.3.0/24</ns2:ipAddress>
                   
</ns2:criterion>
               
</operand>
           
</operations>
       
</mutate>
   
</soapenv:Body>
</soapenv:Envelope>

Please let me know if you face any issues.

Cheers,
Anthony
AdWords API Team
Reply all
Reply to author
Forward
0 new messages