使用 HERE Geolocation API 从文本中获取城市建议列表

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

我正在尝试找到从用户编写的文本中获取城市名称建议列表的方法。我已经设法使用 HERE Geocoder Autocomplete API 来做到这一点,但我想使用最新的 Rest API 版本 Geocoding and Search API v7.

请查看GS V7 Autosuggest的用法,地址和POI均可使用,详情见here

例如,API 调用 https://autosuggest.search.hereapi.com/v1/autosuggest?at=52.5199813,13.3985&limit=5&q=res&apiKey=apiKey 将得到如下响应。 您应该能够从 address:city 字段解析并获取地址。

    "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"
        },