/location_mapper

The /location_mapper call allows Content API users to map their existing property IDs to TripAdvisor Location IDs, which can be used in /location API calls. Some key differences from regular Content API calls are:

  • Users may access the /location_mapper call by providing their API key appended with "-mapper"
  • This mapping-specific key has limits of 25,000 API calls per day and 100 API calls per second. This is to allow users with many properties to write automated scripts which will map their property IDs to TripAdvisor Location IDs in a short amount of time. 
  • Locations must be submitted one at a time, as in the example below. This call does not support multi-get.

Request

http://api.tripadvisor.com/api/partner/2.0/location_mapper/42.344978,-71.119030?key=<CONTENT API KEY HERE>-mapper&category=hotels&q=Beacon%20Townhouse%20Inn%201023

Options

Name Description
category Filters result set based on property type. Valid options are: "hotels", "attractions", and "restaurants". 
q Query string for narrowing searches. Recommended to use property name.

Response

{
  "data": [
    {
      "location_id": "258730",
      "name": "Beacon Townhouse Inn 1023",
      "distance": "0.5806475395682301",
      "bearing": "east",
      "address_obj": {
        "street1": "1023 Beacon Street",
        "street2": "",
        "city": "Brookline",
        "state": "Massachusetts",
        "country": "United States",
        "postalcode": "02446",
        "address_string": "1023 Beacon Street, Brookline, MA 02446"
      }
    }
  ]
}

Properties

Name Description
location_id The TripAdvisor Location ID - to use in any /location API calls.
name Property name.
address_obj Object consisting of various address data.
distance Distance, in miles, this location is from the passed in Lat/Long parameters.
bearing

Direction this location is from the passed in Lat/Long parameters.

 

Recommended Practices

Best results may come from using the category parameter (e.g. "hotels") and passing exact property name into the query parameter. Additionally, the API call does not include any auto-correction, so if you are having trouble getting the correct property returned, be sure to check spelling.

It is recommended that users review all matched TripAdvisor Location IDs with their own list of propery IDs, and store them in a database once confirmed. This allows the user to access a list of confirmed Location IDs instead of relying on the accuracy of the /location_mapper call, which may not always return the desired result, before making a /location call. If you are unable to obtain certain Location IDs using the /location_mapper call, you can also manually check the property's TripAdvisor URL - the Location ID is the number located immediately following the letter "d" in the URL:

http://www.tripadvisor.com/Hotel_Review-g60745-d258705-Reviews-Hotel_Commonwealth-Boston_Massachusetts.html

 

TripAdvisor provides the /location_mapper call as-is, and, as with the rest of the Content API, does not provide any official support.