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 Description Example
input String (required) The input string that you want to autocomplete. This input string could be a partial address, a place name, or any other string that you want to find a match for Landmark 81
key String (required) API key public_key
bounds {latitude},{longitude};{latitude},{longitude} The bounding box of the viewport within which to bias geocode results more prominently. This parameter will only influence, not fully restrict, results from the geocoder 21.6463420,104.8429379;21.7503187,104.9330227
size Number The maximum number of results to return from the search. 5
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 Boolean Return address according to new administrative boundaries true
include_old_admin Boolean (Use with new_admin) Return both new and old addresses true

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&bounds=21.6463420,104.8429379;21.7503187,104.9330227&size=2&key=public_key

This example demonstrates how to request data in XML format:

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


# XML
curl -G "https://maps.track-asia.com/api/v2/place/autocomplete/xml" \
--data-urlencode "input=Landmark 81" \
--data-urlencode "bounds=21.6463420,104.8429379;21.7503187,104.9330227" \
--data-urlencode "location=10.7952219,106.7217912" \
--data-urlencode "size=5" \
--data-urlencode "key=public_key" \
--data-urlencode "new_admin=true" \
--data-urlencode "new_include_old_admin=true"
// JSON
const response = await fetch("https://maps.track-asia.com/api/v2/place/autocomplete/json?input=Landmark 81&bounds=21.6463420,104.8429379;21.7503187,104.9330227&size=2&key=public_key")
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&bounds=21.6463420,104.8429379;21.7503187,104.9330227&key=public_key")
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").
  • warning_message: (Optional) Warning message about parameters or query, e.g., "Invalid Parameter: bounds".
  • predictions: Array of prediction objects. Each object includes:
    • 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 (like predictions, terms) become repeated elements in XML (like <prediction>, <term>).
  • Blank elements are indicated by empty arrays in JSON, but by the absence of such elements in XML.

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