realtallpaul
realtallpaul

Reputation: 93

How to filter results in HERE v7 Autosuggest response?

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

Answers (1)

SuperTony0
SuperTony0

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:

https://discover.search.hereapi.com/v1/discover?at=49.9741,8.44181&q=potzdamerplatz&types=administrativeArea,locality,street,houseNumber

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

Related Questions