Hi Jeff,

Currently, we do not have a specific PHP example that would replace an IP 
Exclusion list from a campaign. However, since you will be deleting the 
entire existing IP_BLOCK criteria with a new set of IP_BLOCK criteria, then 
you can use the CampaignCriterionService.get() 
<https://developers.google.com/adwords/api/docs/reference/v201710/CampaignCriterionService#get>
 filtering 
by CriteriaType 
<https://developers.google.com/adwords/api/docs/reference/v201710/CampaignCriterionService.CampaignCriterion#campaigncriteriontype>
 = 
IP_BLOCK and the specific campaign ID to get the list of the criterion. 

You can then store the list of criterion into an array, and then use them 
as an operand in per CampaignCriterionOperation for the REMOVE operator. 
For your new IP_BLOCK criterion, you can create a new set of 
CampaignCriterionOperation with operator = ADD. Please see below for a 
sample SOAP request snippet on which you can pattern for your PHP code:

<soapenv:Body>
        <mutate xmlns="https://adwords.google.com/api/adwords/cm/v201710";>
            <operations>
                *<operator>REMOVE</operator>*
                <operand xmlns:ns2=
"https://adwords.google.com/api/adwords/cm/v201710"; xsi:type=
"ns2:NegativeCampaignCriterion">
                    <ns2:campaignId>XXXXXXXXXXXXXXX</ns2:campaignId>
                    <ns2:isNegative>true</ns2:isNegative>
                    <ns2:criterion xsi:type="ns2:IpBlock">
                        <ns2:id>XXXXXXXXXXXX</ns2:id>
                        <ns2:type>IP_BLOCK</ns2:type>
                        <ns2:Criterion.Type>IpBlock</ns2:Criterion.Type>
                        <ns2:ipAddress>XXX.X.X.XXX/XX</ns2:ipAddress>
                    </ns2:criterion>
                    <ns2:CampaignCriterion.Type>NegativeCampaignCriterion
</ns2:CampaignCriterion.Type>
                </operand>
            </operations>
            <operations>
                *<operator>ADD</operator>*
                <operand xmlns:ns3=
"https://adwords.google.com/api/adwords/cm/v201710"; xsi:type=
"ns3:NegativeCampaignCriterion">
                    <ns3:campaignId>XXXXXXXXXXXXXXXX</ns3:campaignId>
                    <ns3:criterion xsi:type="ns3:IpBlock">
                        <ns3:ipAddress>XX.X.X.XXX/XX</ns3:ipAddress>
                    </ns3:criterion>
                </operand>
            </operations>
        </mutate>
</soapenv:Body>

Let me know if you have further clarifications.

Thanks,
Vincent
AdWords API Team

-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog and Google+:
https://googleadsdeveloper.blogspot.com/
https://plus.google.com/+GoogleAdsDevelopers/posts
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~

You received this message because you are subscribed to the Google
Groups "AdWords API Forum" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/adwords-api?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"AdWords API Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
Visit this group at https://groups.google.com/group/adwords-api.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/adwords-api/5783f4af-bf57-4688-9b95-75601dded530%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
  • Replace IP Exclu... Jeff C
    • Re: Replace... 'Vincent Racaza (AdWords API Team)' via AdWords API Forum

Reply via email to