Skip to content

Help users find what they're looking for without requiring them to fully specify their search term.

Endpoint

https://maps.track-asia.com/api/v2/place/autocomplete/{outputFormat}

outputFormat

outputFormat Description
json (recommended) indicates output in JavaScript Object Notation (JSON)
xml indicates output in XML

Parameters

Parameter Values Require Description Example
input String (required) The input string you want to autocomplete. It can be part of an address, a place name, or any other string for which you want to get matching results Landmark 81
key String (required) API key (use your own key; public_key is limited and for testing only) public_key
location {latitude},{longitude} The latitude and longitude values specifying the location for which you wish to obtain the closest, human-readable address. 10.7952219,106.7217912
new_admin true , false (default) Return address according to new administrative boundaries true
include_old_admin Boolean Return both the old and new addresses (only available when new_admin=true) true
size Number The maximum number of results to return from the search. 5

Example Code

This example demonstrates how to request data in JSON format:

https://maps.track-asia.com/api/v2/place/autocomplete/json?input=Landmark 81&size=2&key=public_key&new_admin=true&include_old_admin=true

This example demonstrates how to request data in XML format:

https://maps.track-asia.com/api/v2/place/autocomplete/xml?input=Landmark 81&size=2&key=public_key&new_admin=true
# JSON
curl -G "https://maps.track-asia.com/api/v2/place/autocomplete/json" \
--data-urlencode "input=Landmark 81" \
--data-urlencode "location=10.7952219,106.7217912" \
--data-urlencode "size=5" \
--data-urlencode "key=public_key" \
--data-urlencode "new_admin=true" \
--data-urlencode "include_old_admin=true"


# XML
curl -G "https://maps.track-asia.com/api/v2/place/autocomplete/xml" \
--data-urlencode "input=Landmark 81" \
--data-urlencode "location=10.7952219,106.7217912" \
--data-urlencode "size=5" \
--data-urlencode "key=public_key" \
--data-urlencode "new_admin=true"
// JSON
const response = await fetch("https://maps.track-asia.com/api/v2/place/autocomplete/json?input=Landmark 81&size=2&key=public_key&new_admin=true&include_old_admin=true")
const data = await response.json()
console.log(data)

// XML
const response = await fetch("https://maps.track-asia.com/api/v2/place/autocomplete/xml?input=Landmark 81&size=2&key=public_key&new_admin=true")
const data = await response.text()
console.log(data)

Response

JSON Response

The response is a JSON object with the following structure:

  • status: Status string (e.g., "OK").
  • predictions: Array of prediction objects. Each object includes:

    • official_id: The official administrative code from the National Administrative Catalogue. This field is only returned when the result is an administrative unit (e.g., ward, city/province).
    • place_id: Unique identifier for the place.
    • reference: Reference for the place (may be the same as place_id).
    • name: Name of the place.
    • description: Full description of the place.
    • formatted_address: Full formatted address.
    • icon: Icon code representing the place type.
    • matched_substrings: Array of objects indicating which substrings of the input matched.
    • structured_formatting: Object with main_text, main_text_matched_substrings, and secondary_text for display formatting.
    • terms: Array of objects with offset and value for each term in the result.
    • types: Array of place types.
    • old_description: (Optional) Old address description if available.
    • old_formatted_address: (Optional) Old formatted address if available.
XML Response

The XML response has a similar structure, with elements corresponding to the JSON fields above. Notable differences:

  • XML results are wrapped in a root <AutocompletionResponse> element.
  • Arrays in JSON (such as predictions, terms...) become repeated elements in XML.
  • Blank elements are indicated by empty arrays in JSON, but by the absence of such elements in XML.

Important Notes

Status

Status Description
OK indicating the API request was successful.
ZERO_RESULTS indicating that the search was successful but returned no results. This may occur if the search was passed a bounds in a remote location.

Error messages

When the geocoder returns a status code other than OK, there may be an additional error_message field within the Geocoding response object. This field contains more detailed information about the reasons behind the given status code.

Next steps