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 | Toa nha BW |
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 |
Example Code
https://maps.track-asia.com/api/v2/place/autocomplete/json?input=Toa nha BW&bounds=21.6463420,104.8429379;21.7503187,104.9330227&size=2&key=public_key
https://maps.track-asia.com/api/v2/place/autocomplete/xml?input=Toa nha BW&bounds=21.6463420,104.8429379;21.7503187,104.9330227&key=public_key
Response
JSON Response
The response is a JSON object with the following structure:
status
: Status string (e.g., "OK").predictions
: An array of prediction objects. Each prediction contains:place_id
: Unique identifier for the place.reference
: Reference for the place (may be the same asplace_id
).name
: Name of the place.sublabel
: Additional address or context for the place.description
: Full description of the place.matched_substrings
: Array of objects indicating which substrings of the input matched.structured_formatting
: Object withmain_text
,main_text_matched_substrings
, andsecondary_text
for display formatting.terms
: Array of objects withoffset
andvalue
for each term in the result.geometry
: Object withlocation
(lat/lng),location_type
, andviewport
(northeast/southwest bounds).plus_code
: Object withcompound_code
andglobal_code
.types
: Array of place types.
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. |
Next steps
- Try API playground