Retrieve Location Details for a Suggestion

After the user types a few characters, request a list of suggestions from the HERE Geocoder Autocomplete API. Show the suggestions to the user. After the user selects a suggestion, retrieve the detailed location information corresponding to the suggestion using the Geocoder API.

Request

Request a list of address suggestions for the search text Pariser 1 Berl:

https://autocomplete.geocoder.ls.hereapi.com/6.2/suggest.json
?apiKey={YOUR_API_KEY}
&query=Pariser+1+Berl
&beginHighlight=<b>
&endHighlight=</b>         
Note: This example uses a HERE API Key to authenticate your request. For the available authentication options, see the Identity & Access Management Developer Guide.

Response

The response from the HERE Geocoder Autocomplete API contains a number of suggestions. Each of them represents a location defined through a set of attributes, but these do not provide detailed location information such as geographic coordinates.

{
   "suggestions": [
      {
        "label": "Deutschland, Berlin, Berlin, 10117, Berlin, Pariser Platz 1",
        "language": "de",
        "countryCode": "DEU",
        "locationId": "NT_5mGkj3z90Fbj4abzMbUE4C_xA",
        "address": { ... },
        "matchLevel": "houseNumber"},
      ... ]
}

Geocoder Request to retrieve the Location Details

After the user has selected a suggestion, you can retrieve the location details such as the geographic coordinates via the HERE Geocoder API, using look-up by locationId.

Here is the request to the Geocoder API. For more information about the HERE Geocoder API, see the Geocoder API Developer's Guide.
https://geocoder.ls.hereapi.com/6.2/geocode.json
?locationid=NT_5mGkj3z90Fbj4abzMbUE4C_xA
&jsonattributes=1
&gen=9
&apiKey={YOUR_API_KEY}
Note: This example uses a HERE API Key to authenticate your request. For the available authentication options, see the Identity & Access Management Developer Guide.

Geocoder Response

{        
  "response":
...
      "view": [{
         "result": [{
            "matchLevel": "houseNumber",
            "matchType": "pointAddress",
            "location": {
               "locationId": "NT_5mGkj3z90Fbj4abzMbUE4C_xA",
               "locationType": "point",
               "displayPosition": {
                  "latitude": 52.51588,
                  "longitude": 13.37804 },
               "navigationPosition": [{
                  "latitude": 52.51591,
                  "longitude": 13.37833 }],
            "mapView": {
               "topLeft": {
                  "latitude": 52.5248732,
                  "longitude": 13.3632617 },
               "bottomRight": {
                  "latitude": 52.5068868,
                  "longitude": 13.3928183 }},
            "address": {
               "label": "Pariser Platz 1, 10117 Berlin, Deutschland",
               "country": "DEU",
               "state": "Berlin",
               "county": "Berlin",
               "city": "Berlin",
               "district": "Mitte",
               "street": "Pariser Platz",
               "houseNumber": "1",
               "postalCode": "10117",
               "additionalData": [{
                  "value": "Deutschland",
                  "key": "CountryName" },
                  {
                  "value": "Berlin",
                  "key": "StateName" },
                  {
                  "value": "Berlin",
                  "key": "CountyName" }]}}}],
         "viewId": 0 }]
    }
}