Could I set a specific level (ie: country, city) when I search Location ID for Location Name when using "LocationCriterionService"?

84 views
Skip to first unread message

李友良

unread,
May 12, 2017, 6:35:30 AM5/12/17
to AdWords API Forum
According to the example: lookup_location.py, I can see the selector like this when I need to find the location ID:

location_names = ['Paris']
selector = {
      'fields': ['Id', 'LocationName', 'DisplayType', 'CanonicalName', 'ParentLocations', 'Reach', 'TargetingStatus'],
      'predicates': [{
          'field': 'LocationName',
          'operator': 'IN',
          'values': location_names
      }, {
          'field': 'Locale',
          'operator': 'EQUALS',
          'values': ['en']
      }]
  }


The printed results:
The search term 'Paris' returned the location 'Paris' of type 'City' with parent locations 'Ile-de-France (Region), France (Country)', reach '20800000' and id '1006094' (ACTIVE)
The search term 'Paris' returned the location 'Paris' of type 'Department' with parent locations 'Ile-de-France (Region), France (Country)', reach '20800000' and id '9040871' (ACTIVE)
The search term 'Paris' returned the location 'Charles de Gaulle Airport' of type 'Airport' with parent locations 'Ile-de-France (Region), France (Country)', reach '512000' and id '9059985' (ACTIVE)
The search term 'Paris' returned the location 'Paris' of type 'City' with parent locations 'Texas (State), United States (Country)', reach '73000' and id '1026678' (ACTIVE)
The search term 'Paris' returned the location '75012' of type 'Postal Code' with parent locations 'Ile-de-France (Region), France (Country)', reach '7080000' and id '9056136' (ACTIVE)
The search term 'Paris' returned the location '89109' of type 'Postal Code' with parent locations 'Nevada (State), United States (Country)', reach '4640000' and id '9030795' (ACTIVE)
The search term 'Paris' returned the location 'Paris' of type 'City' with parent locations 'Tennessee (State), United States (Country)', reach '54000' and id '1026100' (ACTIVE)
The search term 'Paris' returned the location 'Orly Airport' of type 'Airport' with parent locations 'Ile-de-France (Region), France (Country)', reach '247000' and id '9041209' (ACTIVE)
The search term 'Paris' returned the location 'Paris' of type 'Neighborhood' with parent locations 'Ontario (Province), Canada (Country)', reach '20000' and id '1002378' (ACTIVE)
The search term 'Paris' returned the location 'Paris' of type 'City' with parent locations 'Kentucky (State), United States (Country)', reach '31000' and id '1017861' (ACTIVE)

So I know the filterable fields include: Locale, LocationName
However, in the API reference documentation: LocationCriterionService.LocationCriterion, the filterable fields is: Locale, CountryCode.
Does the doc miss LocationName?

And because it will return many results in different level as response, so I wonder is there any filterable fields could set a specific level in selector?


Shwetha Vastrad (AdWords API Team)

unread,
May 12, 2017, 12:06:39 PM5/12/17
to AdWords API Forum
Hi, 

As stated here, the locationName field is filterable only in LocationCriterionService and cannot be greater than 300 characters if used as a filter. I'm afraid the displayType field is not filterable. You could consider filtering out values from the response based on the displayType of each locationCriterion. 

Regards,
Shwetha, AdWords API Team.

李友良

unread,
May 14, 2017, 9:49:36 PM5/14/17
to AdWords API Forum
Thank you for your reply, I see.
Reply all
Reply to author
Forward
0 new messages