I'm trying to attach an audience list - which I have already created on 
Google ads using the python api - to an existing campaign on the same 
Google ads account. I have both the ID of the campaign and the ID of the 
audience list, but I did not find any clear example in the documentation on 
how to attach an audience list to campaign.


Can anyone provide example on how the json object to be sent to google ads 
is structured to request adding an audience list to a campaign?


I tried to follow the reference guidelines in the documentation 
<https://developers.google.com/adwords/api/docs/reference/v201809/CampaignCriterionService.CampaignCriterion>
 to 
compose the request json format object needed to be sent to add an audience 
list to a certain campaign .

```python

from googleads import adwordsimport yaml

data = {} # should contain credentials for authentication

auth_data = yaml.dump(data)
client = adwords.AdWordsClient.LoadFromString(auth_data)

campaign_criterion_list_service = client.GetService(
    'CampaignCriterionService', version='v201809')

 operations = [ 
    { 
        'operand': { 
            'campaignId': 1982314222, # some campaign in my account

            'criterion': { 
                'type': 'USER_LIST',
                'id': 823895895,# an existing audience list on my  google ads 
account
            }, 
            'campaignCriterionStatus': 'ACTIVE' 
        }, 
        'operator': 'ADD', 
    } 
 ]
campaign_criterion_list_service.mutate(operations)

```

But it fails providing the error
```

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

```


And also searched for similar problems, found this solution 
<https://groups.google.com/forum/#!topic/adwords-api/rxKnXiJtfl4> in 
Java,but I did not succeed into coming up with a similar one in python.

-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog:
https://googleadsdeveloper.blogspot.com/
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~

You received this message because you are subscribed to the Google
Groups "AdWords API and Google Ads API Forum" group.
To post to this group, send email to adwords-api@googlegroups.com
To unsubscribe from this group, send email to
adwords-api+unsubscr...@googlegroups.com
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 and Google Ads API Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to adwords-api+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/adwords-api/25395d71-342b-4f33-909f-cf801fd7d167%40googlegroups.com.

Reply via email to