Autocomplete
Allows you to implement real-time type-ahead functionality in your end-user application.
Description
By using the /autocomplete
endpoint, users can receive instant feedback and suggestions as they type. This feature helps users find what they are looking for without having to fully specify their search term. Additionally, you can enhance the search results by specifying a geographic point to focus the search on, providing more localized results.
To build a query with autocomplete, you need a text parameter, representing what a user has typed into your application so far. Optionally, you can specify a geographic point where the search is focused, this will allow users to see more local places in the results.
When using that, just use our Enterprise Dashboard or guild API Key to create your API Key try for free!
Openmap.vn Autocomplete API can return OSM or Google response format.
Base URL
https://mapapis.openmap.vn/v1
Endpoint
GET /autocomplete
Google format
API references
Parameter | Type | Required | Default | Description | Example |
---|---|---|---|---|---|
input | string | yes | none | Your search keyword | Công Ty TNHH Công Nghệ 44+ |
location | string | no | none | Location bias search | 21.03279,105.78788 |
origin | string | no | none | The origin point from which to calculate straight-line distance to the destination (returned as distance_meters ). Must be specified as latitude,longitude | 21.03279,105.78788 |
radius | number | no | 50 | Limits search to a radius from specified location (in km) | 10 |
sessiontoken | string | no | none | A UUID v4 token to group multiple Autocomplete requests in 1 session | 576e6543-fbc8-422c-9aad-9884c97df128 |
Example
Request:
GET /autocomplete?input=Công ty TNHH Công Nghệ 44+&location=21.03279,105.78788&radius=50
Response:
{
"predictions": [
{
"description": "Công Ty TNHH Công Nghệ 44+, 12 Ngõ 1 Dịch Vọng Hậu, phường Dịch Vọng Hậu, quận Cầu Giấy, thành phố Hà Nội",
"matched_substrings": [
{
"length": 2,
"offset": 23
}
],
"place_id": "BFMhbS2hGqAeWlxPGNjnClF6aYQk3F1-nXJxZZjAncYpdqHZSNzpfi0W3RCU",
"structured_formatting": {
"main_text": "Công Ty TNHH Công Nghệ 44+",
"main_text_matched_substrings": [
{
"length": 2,
"offset": 23
}
],
"secondary_text": "12 Ngõ 1 Dịch Vọng Hậu, phường Dịch Vọng Hậu, quận Cầu Giấy, thành phố Hà Nội",
"secondary_text_matched_substrings": [
]
},
"terms": [
{
"offset": 0,
"value": "Công Ty TNHH Công Nghệ 44+"
},
{
"offset": 31,
"value": "12 Ngõ 1 Dịch Vọng Hậu"
},
{
"offset": 62,
"value": "phường Dịch Vọng Hậu"
},
{
"offset": 93,
"value": "quận Cầu Giấy"
},
{
"offset": 114,
"value": "thành phố Hà Nội"
}
],
"types": [
"corporate_office"
],
"distance_meters": null
}
],
"status": "OK"
}
OSM format
API references
Parameter | Type | Required | Default | Description | Example |
---|---|---|---|---|---|
text | string | yes | none | Your search keyword | Công Ty TNHH Công Nghệ 44+ |
boundary.circle.lat | floating point number | no | none | Latitude | 21.03279 |
boundary.circle.lon | floating point number | no | none | Longitude | 105.78788 |
boundary.circle.radius | number | no | 50 | Limits search to a radius from specified location (in km) | 10 |
sessiontoken | string | no | none | A UUID v4 token to group multiple Autocomplete requests in 1 session | 576e6543-fbc8-422c-9aad-9884c97df128 |
Example
Request:
GET /autocomplete?text=Công ty TNHH Công Nghệ 44+&size=1
Response:
{
"errors": null,
"features": [
{
"type": "Feature",
"properties": {
"name": "Công Ty TNHH Công Nghệ 44+",
"housenumber": null,
"street": null,
"short_address": "12 Ngõ 1 Dịch Vọng Hậu",
"postalcode": null,
"label": "Công Ty TNHH Công Nghệ 44+, 12 Ngõ 1 Dịch Vọng Hậu, phường Dịch Vọng Hậu, quận Cầu Giấy, thành phố Hà Nội",
"country": "Việt Nam",
"country_code": "VN",
"category": [
"corporate_office"
],
"website": null,
"opening_hours": null,
"phone": null,
"region": "thành phố Hà Nội",
"county": "quận Cầu Giấy",
"locality": "phường Dịch Vọng Hậu",
"distance": null,
"id": "BFMhbS2hGqAeWlxPGNjnClF6aYQk3F1-nXJxZZjAncYpdqHZSNzpfi0W3RCU",
"continent": "Asia",
"source": "openmapvn"
}
}
],
"bbox": [
],
"type": "FeatureCollection"
}