Locate Service: Locate Suggestions API

This api service allows you to get a list of suggested places based on the place you are searching for.

Request Body: JSON

{
  "service": "locate-suggestions",
  "payload": {
    "search_term": "Luong Bang",
    "limit": 5,
    "country_filter": ["VNM"] 
  }
}

Request Body Definition

  • service - This defines the service that we want to use
  • payload - Information needed in order for the service to process the request
  • payload.search_term - This is the search term for the place you are searching for.
  • payload.limit - Optional integer: This is the number of results you want to retrieve. The default value is 5 if not provided.
  • payload.country_filter - Optional list of strings: This is a list of country codes using 3-letter ISO 3166 codes where you want suggestions to be based from. If you do not provide this, it will suggest places that match globally.

Sample Response

If your request is successful, you will receive the following response where you get the result and the credits you have left after making the request, with a status code of 200.

{
  "result": {
      "suggestions": [
          "Lương Bằng, Chợ Đồn, Bắc Kạn, VNM",
          "Lương Bằng, Kim Động, Hưng Yên, VNM",
          "Luong Bang, Hưng Yên, VNM",
          "Luong Bang, Phú Thọ, VNM",
          "Lương Bằng, Bắc Kạn, VNM"
      ],
      "search_term": "Luong Bang"
  },
  "remaining_credits": 809
}

If your request is not successful, you will receive a message from the json response describing the error. Possible errors may be due to:

  • Invalid API token with status code 401
  • Invalid service name with status code of 422
  • Not enough credits with status code of 422
  • Invalid payload with status code of 422

Response Data Definition

  • result - A dictionary containing the key suggestions which contains the list of places that match the search term.
  • remaining_credits - The remaining locate credits after calling the api service.