Search code examples
apirestgeolocationhere-api

Get a list of cities suggestions from text with HERE Geolocation API


I'm trying to find the way to get a list of cities names suggestions from a text written by user. I've managed to do it using the HERE Geocoder Autocomplete API but I would like to use the latest Rest API version Geocoding and Search API v7.

  • Does the 7 version substitute the other APIs?
  • Is there a way to find cities names suggestions in v7 API?

Solution

  • Please check the usage on GS V7 Autosuggest, it can be used for both address and POI, details in here.

    For example, API call https://autosuggest.search.hereapi.com/v1/autosuggest?at=52.5199813,13.3985&limit=5&q=res&apiKey=apiKey will get response like below. You should be able to parse and get the address from address:city field.

        "items": [
        {
            "title": "Hackescher Hof",
            "id": "here:pds:place:276u33db-fb00197ffa5041b2b656ea3d23145dca",
            "resultType": "place",
            "address": {
                "label": "Hackescher Hof, Rosenthaler Straße 40, 10178 Berlin, Deutschland",
                "countryCode": "DEU",
                "countryName": "Deutschland",
                "state": "Berlin",
                "county": "Berlin",
                "city": "Berlin",
                "district": "Mitte",
                "street": "Rosenthaler Straße",
                "postalCode": "10178",
                "houseNumber": "40"
            },