Reputation: 93
I'm wondering if it is possible to filter the category of results returned from the /autosuggest endpoint. For my application I would only like locations (towns, city, etc) to be returned.
The previous version of the API supported this filtering functionality.
As a workaround would I need to filter the results returned to the categories that I want myself?
Upvotes: 3
Views: 155
Reputation: 11
I had sent a support question to Here with a similar question and the response may be helpful for you too.
TLDR: There is a 'types' query param that is not in the documentation with the following valid values administrativeArea, country, state, county, locality, postalCode, city, district, subdistrict, houseNumber, place, street
Adding 'types=city' parameter will bring you only cities in the result.
e.g.) https://discover.search.hereapi.com/v1/discover?at=49.9741,8.44181&q=berlin&types=city
Likewise, if you want to obtain only address results, you can do as following:
Note that locality includes city, postalCode, district, subdistrict.
Or if you want to also add counties, states, or countries, you can add 'county', 'state', or 'country' to the 'types' parameter, respectively.
You can designate following type for result filters.
administrativeArea country state county locality postalCode city district subdistrict houseNumber place street
Upvotes: 1