问题
I try to get HERE place information by place id. Something like
https://places.cit.api.here.com/places/v1/places/276u337n-1e7e6de955674eddb3ba8662d8a83bac?app_id={XXXX}&app_code={YYYY}
returns
It is not permissible to use URL templating. Please follow the Places API Developer Guide: https://developer.here.com/rest-apis/documentation/places/topics/required-user-flow.html
I understand the use and concept of URL templating but the link does not provide me with the information to get place information by Here ID. Anybody know how to do this?
回答1:
Short disclaimer: I work in the team around HERE places API.
The querying for place ids directly is not supported because they might change over time and become stale. So the idea is that clients don't store them over longer periods of time.
The basic entrypoint to the Places API is to do a search first, e.g.
/discover/search and follow the href
fields in the response items to get to the details of a place.
I am not quite sure what your use case is but if the above doesn't work in your flow, I would suggest extracting the sharing ids. You can find those inside the place details in the response field 'view', it is the part starting with s-
.
But to get to the place details you will have to do a search at one point and follow the href
. The sharing id contains more information than just the place id so it should resolve more reliably.
Once you have obtained sharing ids, you can you use the lookup endpoint. Be prepared to follow a 302 HTTP response.
来源:https://stackoverflow.com/questions/46001526/finding-place-by-here-id