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