Selecting ad groups by campaign name with CONTAINS_ANY predicate type (Python googleads API)

173 views
Skip to first unread message

Preston Hinkle

unread,
Sep 26, 2018, 1:31:13 AM9/26/18
to AdWords API and Google Ads API Forum
Hello,

As the question title states, I'm trying to select all ad groups with campaign names satisfying a CONTAINS_ANY relationship. I assume this is possible since the AdWords API documentation says that campaign name can be filtered on for ad groups. However, when I try I receive the following error: 

GoogleAdsServerFault: [SelectorError.INVALID_PREDICATE_OPERATOR @ serviceSelector; trigger:'CampaignName']

I'm using the AdGroupService's get() method, and my selector looks like this:

{
'fields': 
['Id', 'CampaignId', 'CampaignName', 'Name', 'Status', 'Settings', 'Labels', 'AdRotationMode'],
'predicates': 
[{'field': 'CampaignName', 'operator': 'CONTAINS_ANY', 'values': ['dmageo']}],
'paging': 
{'startIndex': 0, 'numberResults': '10000'}
 }


Filtering by CampaignId works perfectly fine, but CampaignName (and Campaign, campaignName, ...) for whatever reason doesn't work. Any idea?

Thanks!


Luis Xander Talag (AdWords API Team)

unread,
Sep 26, 2018, 6:36:28 AM9/26/18
to AdWords API and Google Ads API Forum
Hi Preston,

The INVALID_PREDICATE_OPERATOR error indicates that you are using an unsupported predicate for the CampaignName field. You may use the CONTAINS predicate instead of CONTAINS_ANY to filter by CampaignName. Let me know how it goes and if you have any further clarifications. 

Thanks and regards,
Luis
AdWords API Team

Preston Hinkle

unread,
Sep 27, 2018, 3:51:02 PM9/27/18
to AdWords API and Google Ads API Forum
Hi Luis,

Ok, I misunderstood the error message to mean that the trigger 'CampaignName' as at fault, but it looks like 'CampaignName' is just the key for the operator that was at fault.

Thanks!

Preston
Reply all
Reply to author
Forward
0 new messages