The Autosuggest API helps users to complete queries faster by adding intelligent search capabilities to your web or mobile app. This API returns a list of results as well as suggested queries as the user types in the search field.
- Basic URL structure:
http://apis.mapmyindia.com/advancedmaps/v1/<licence key>/autosuggest?q=<query string>
The output format would be JSON.
- HTTP Request Method:
The following input parameters will be supported in the Autosuggest API request –
- q: The query string (mmi000, India Gate, Coffee)
a. mmi000: an eLoc, this would return a collection with 1 item.
b. India Gate: a POI, this would return a collection with multiple items associated to India
c. Coffee: a location search, returns all shops that have coffee in their name.
Please Note: The query string can be http encoded or simple although preferably encoded to provide flexibility for special characters.
- Licence key: the REST API licence key allocated to you by signing into our services and
registering yourself as a developer (28 Char Alphanumeric).
The API returns an enveloped response with the autosuggested data in the results object.
- responseCode (int): The response code of the operation.The 400 series is for client side (yours) error while 500 series for server side (ours) error, 200 for success.
- Version (string): The version of the API you’re connected to.
- results (object[ ]): A collection of autosuggested response data sorted in the order of the best match to the input query, each consisting of the following parameters
- type (string): defines the type of location matched (HOUSE_NUMBER, HOUSE_NAME, POI, STREET, SUB_LOCALITY, LOCALITY, VILLAGE, DISTRICT, SUB_DISTRICT, CITY, STATE, SUBSUBLOCALITY, PINCODE)
- addr (string): formatted address based on the best matches of query item
- y (double): latitude of the location.
- x (double): longitude of the location.
- place_id (string):The eLoc or placeId assigned for a place in map database. An eLoc is the digital identity for an address or business to identify its unique location. For more information on eLoc, click here.
e: The Latitude and Longitude will be a part of only the first Item of the result collection as it’s the best matched result. To get the data about the other search responses, pass in the eLoc of the location to the Place Details API. Max number of results that will be received is 5.
The Autosuggest API must respond within 100 Ms under all circumstances on a stable internet connection although on an unstable one, response times may vary.
One request using the API link will be considered as one transaction. For any string in the input, the output will be list of address matching with that string. This is considered as one transaction.
So, if the autosuggest response does not contain any data it won’t be counted.
- In a simple textbox to provide location related information.
- In a routing case scenario where you want to provide and verify with address.
- To quickly verify a provided location/eLoc
"addr": "New Delhi, Delhi",
"addr": "New Delhi District, Delhi",
"addr": "New Delhi Colony, Dhanbad, Jharkhand",
"addr": "New Delhi Domestic Airport Parking, Igi Airport Area, New Delhi, Delhi",
"addr": "New Delhi Tours, Block 11, Rehgarpura, Karol Bagh, New Delhi, Delhi",