Correct query spelling mistakes
This tutorial demonstrates how the API corrects query spelling mistakes.
Procedure
A user in New Jersey searching for the New York Giants football stadium on his cellphone using an app, omits the letter "r", misspelling this stadium as "New Yok Gia" in the query:
GET https://autosuggest.search.hereapi.com/v1
/autosuggest
?at=40.8870025,-74.0459472
&q=New+Yok+Gia
&limit=2
&apiKey={YOUR_API_KEY}
The following parameters are used:
- at - Specify the center of the search context expressed as coordinates.
- q - Enter a free-text query.
- limit - Maximum number of results to be returned.
- apiKey - Your API key.
Note
This request uses API key authentication. For more information about authentication options on the HERE platform, see the Identity & Access Management Guide.
The API includes the correct location for "New York Giants" in the items:
{
"items": [
{
"title": "New York Giants",
"id": "here:pds:place:8408lxx5-e06a65cc857e0b16d1700eb05bf23def",
"resultType": "place",
"address": { "label": "New York Giants, 1 Road D, East Rutherford, NJ 07073, United States" },
"position": { "lat": 40.81509, "lng": -74.07485 },
"access": [{ "lat": 40.81521, "lng": -74.07483 }],
"distance": 8357,
"categories": [
{ "id": "800-8600-0197", "name": "Sports Activities", "primary": true },
{ "id": "200-2000-0015", "name": "Live Entertainment-Music" },
{ "id": "200-2200-0000", "name": "Theatre, Music and Culture" }
],
"references": [{ "supplier": { "id": "yelp" }, "id": "M3oWhuYk1zA_m8XnFQcUsg" }],
"highlights": { "title": [{ "start": 0, "end": 12 }], "address": { "label": [{ "start": 0, "end": 12 }] } }
},
{
"title": "New York, NY, United States",
"id": "here:cm:namedplace:21019301",
"resultType": "locality",
"localityType": "city",
"address": { "label": "New York, NY, United States" },
"position": { "lat": 40.71455, "lng": -74.00714 },
"distance": 19452,
"mapView": { "west": -74.2589, "south": 40.47742, "east": -73.70038, "north": 40.91762 },
"highlights": { "title": [{ "start": 0, "end": 8 }], "address": { "label": [{ "start": 0, "end": 8 }] } }
}
],
"queryTerms": [ ]
}
Additional information
For more information about /autosuggest
parameters, see: API Reference.