Response language

The geocode /autocomplete endpoint tries to complete the input text by matching the text terms to parts of an address or an administrative area. The /autocomplete endpoint tries to detect the query language based on matching name variants and then chooses the same language for the response. Therefore the end-user can see and recognize all the input terms in the same language as in the query. And overall response language is consistent.

In the following example, the user is looking for an address in Athens, Greece. The user types the address in English:

GET https://autocomplete.search.hereapi.com/v1/
    autocomplete
    ?q=Athens+Stad

Authorization: Bearer [your token]

The /autocomplete endpoint returns the result in English or, if English is not available for some address components, in the Latin transliteration of the Greek names:

{
  "items": [
    {
      "title": "Ellada, Athens, Stadiou",
      "id": "here:af:street:mTYB6ndFpB5qtJTUiPvUrD",
      "resultType": "street",
      "address": {
        "label": "Stadiou, 105 51 Athens, Ellada",
        "countryCode": "GRC",
        "countryName": "Ellada",
        "state": "Attiki",
        "county": "Attiki",
        "city": "Athens",
        "district": "Athina",
        "street": "Stadiou",
        "postalCode": "105 51"
      },
      "highlights": {
        "title": [
          {
            "start": 8,
            "end": 14
          },
          {
            "start": 16,
            "end": 20
          }
        ],
        "address": {
          "label": [
            {
              "start": 0,
              "end": 4
            },
            {
              "start": 16,
              "end": 22
            }
          ],
          "city": [
            {
              "start": 0,
              "end": 6
            }
          ],
          "street": [
            {
              "start": 0,
              "end": 4
            }
          ]
        }
      }
    }
  ]
}

With the lang parameter the customer application can specify the preferred response language. It does not change the language of the matched address fields, but sets the language preference for the rest of the address.

In the following example for the same query the user specifies Greek as preferred response language:

GET https://autocomplete.search.hereapi.com/v1/
    autocomplete
    ?q=Athens+Stad
    &lang=el-GR

Authorization: Bearer [your token]

The /autocomplete endpoint returns the matched fields in English as before so that the user can see and recognize them in the response. But it returns all other address components in Greek:

{
  "items": [
    {
      "title": "Ελλάδα, Athens, Stadiou",
      "id": "here:af:street:mTYB6ndFpB5qtJTUiPvUrD",
      "resultType": "street",
      "address": {
        "label": "Stadiou, 105 51 Athens, Ελλάδα",
        "countryCode": "GRC",
        "countryName": "Ελλάδα",
        "state": "Αττική",
        "county": "Αττική",
        "city": "Athens",
        "district": "Αθήνα",
        "street": "Stadiou",
        "postalCode": "105 51"
      },
      "highlights": {
        "title": [
          {
            "start": 8,
            "end": 14
          },
          {
            "start": 16,
            "end": 20
          }
        ],
        "address": {
          "label": [
            {
              "start": 0,
              "end": 4
            },
            {
              "start": 16,
              "end": 22
            }
          ],
          "city": [
            {
              "start": 0,
              "end": 6
            }
          ],
          "street": [
            {
              "start": 0,
              "end": 4
            }
          ]
        }
      }
    }
  ]
}

If the input text terms match to multiple languages, the /autocomplete endpoint returns them in the preferred language, specified by the lang parameter. The second preference is the country default or the primary regional language.

In the following example the term Berli matches to multiple languages, including German and Italian. The customer application has specified Italian as preferred response language:

GET https://autocomplete.search.hereapi.com/v1/
    autocomplete
    ?q=Berli
    &lang=it-IT
    &limit=1

Authorization: Bearer [your token]

The /autocomplete endpoint returns the result in Italian:

{
  "items": [
    {
      "title": "Germania, 10117, Berlino",
      "id": "here:cm:namedplace:20187403",
      "resultType": "locality",
      "localityType": "city",
      "address": {
        "label": "Berlino, Germania",
        "countryCode": "DEU",
        "countryName": "Germania",
        "stateCode": "BE",
        "state": "Berlino",
        "countyCode": "B",
        "county": "Berlino",
        "city": "Berlino",
        "postalCode": "10117"
      },
      "highlights": {
        "title": [
          {
            "start": 17,
            "end": 22
          }
        ],
        "address": {
          "label": [
            {
              "start": 0,
              "end": 5
            }
          ],
          "city": [
            {
              "start": 0,
              "end": 5
            }
          ]
        }
      }
    }
  ]
}

If the customer application does not specify the lang parameter, /autocomplete returns the result in the default language, which is German in this example.

More details about /autocomplete parameters can be found in the API Reference.

results matching ""

    No results matching ""