CONTAINS_ANY not working on Name in Adgroupservice

146 views
Skip to first unread message

Imran Tufail

unread,
Dec 2, 2016, 3:19:46 AM12/2/16
to AdWords API Forum
Hi Google Adwords Team,

i am facing invalid operator in predicate issue. The CONTAINS_ANY is not working on Name (Ad group name) in Ad group service.
The request details and the response error message is shown below.


 
if isinstance(campaign_list, list):
condition = {
'field': 'CampaignId',
'operator': 'IN',
'values': campaign_list
}
else:
condition = {
'field': 'CampaignId',
'operator': 'EQUALS',
'values': [campaign_list]
}
self.SetClientCustomerId(client_customer_id)
offset = 0
selector = {
'fields': ['Id', 'Name', 'Status'],
'predicates': [
condition,
{
'field': 'Name',
'operator': 'CONTAINS_ANY',
'values': identifier_list # the list is show above in image
},

{
'field': 'Status',
'operator': 'NOT_EQUALS',
'values': ['REMOVED']
}
],
'paging': {
'startIndex': str(offset),
'numberResults': str(self.PAGE_SIZE)
},
}
more_pages = True
data = []
while more_pages:
page = self.GetService('AdGroupService').get(selector)



(Fault){
   faultcode = "soap:Server"
   faultstring = "[SelectorError.INVALID_PREDICATE_OPERATOR @ serviceSelector; trigger:'Name']"
   detail = 
      (detail){
         ApiExceptionFault = 
            (ApiExceptionFault){
               message = "[SelectorError.INVALID_PREDICATE_OPERATOR @ serviceSelector; trigger:'Name']"
               ApplicationException.Type = "ApiException"
               errors = 
                  (errors){
                     fieldPath = "serviceSelector"
                     trigger = "Name"
                     errorString = "SelectorError.INVALID_PREDICATE_OPERATOR"
                     ApiError.Type = "SelectorError"
                     reason = "INVALID_PREDICATE_OPERATOR"
                  }
            }
      }
 }

Joyce Lava

unread,
Dec 2, 2016, 3:54:58 AM12/2/16
to AdWords API Forum
Hello Imran,

CONTAINS_ANY works with Labels only at this time. You can use the "IN" operator instead.

You may follow our blog to check on future announcements about this.

Regards,
Joyce, AdWords API Team

Imran Tufail

unread,
Dec 2, 2016, 4:27:18 AM12/2/16
to AdWords API Forum
Thanks Joyce,

But i don't need an exact match as "IN" will look for an exact match. Let me explain a little , suppose my Ad group name is Kabul > Tirana and if the list will contain [ ' Kabul' ].
IN operator will not work on it. I need something with the same functionality as CONTAINS_ANY.

Any suggestions ?
Regards
Imran Tufail

Joyce Lava

unread,
Dec 2, 2016, 5:21:25 AM12/2/16
to AdWords API Forum
Hello Imran,

I'm afraid that the only way I can suggest is to use Label to identify related adGroups. Then use this label to search for those adGroups. IN operator is the closest with CONTAINS_ANY at this time.
Reply all
Reply to author
Forward
0 new messages