I figured out how to do it with API.
python code:
def Add_Negative_User_List(client,campaignId,userListId):
campaign_criterion =
client.GetService('CampaignCriterionService',version=API_VERSION)
operation = {
'operator': 'ADD',
'operand': {
'campaignId': campaignId,
'xsi_type':'NegativeCampaignCriterion',
'criterion': {
'xsi_type': 'CriterionUserList',
'userListId':userListId
}
}
}
response = campaign_criterion.mutate(operation)
return response
On Wednesday, May 18, 2016 at 3:51:58 PM UTC+8, Alex Fung wrote:
>
> Hi all,
>
> I am working on excluding a user list from a list of campaigns with
> Adwords API but I can't figure out how.
>
> What I am trying to do is to exclude a user list on the campaign level.
>
> I have written a function for that:
> API_VERSION = 'v201601'
> def Add_Negative_User_List(client,campaignId):
> campaign_criterion =
> client.GetService('CampaignCriterionService',version=API_VERSION)
> operation = {
> 'operator': 'ADD',
> 'operand': {
> 'campaignId': campaignId,
> 'isNegative':True,
> 'criterion': {
> 'xsi_type': 'CriterionUserList'
> 'userListId':'1234567'
> }
> }
> }
> response = campaign_criterion.mutate(operation)
>
>
> I tried to add the user list as exclusion on the UI and pull the criterion
> with the API.
>
> this is the response:
>
> (CampaignCriterionPage){
> totalNumEntries = 1
> Page.Type = "CampaignCriterionPage"
> entries[] =
> (NegativeCampaignCriterion){
> campaignId = 291250879
> isNegative = True
> criterion =
> (CriterionUserList){
> id = 162191598799
> type = "USER_LIST"
> Criterion.Type = "CriterionUserList"
> }
> CampaignCriterion.Type = "NegativeCampaignCriterion"
> },
> }
>
>
> Please help me out on this.
>
> Thanks,
>
> Alex
>
--
--
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
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/bc4eb664-31fc-4081-96ba-7cfa47b0fb3f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.