Point of interest details

VERSION 1.20.0

POI details request

For the POI results, of a search request, only a limit set of POI attributes is returned. These are the attributes that are the basis to build a basic search application. To build a richer search experience, a POI details request can be performed to obtain all available details about the given POI. It does this by using the ID that is delivered in the search results. To build the POI details request, use the PoiDetailsOptions class. The only required parameter is an identifier of the POI for which you want to get details. To obtain the identifier, get the SearchResultId of the selected SearchResult of a fuzzy search.

Only results of the POI type SearchResult are supported by the POI details request API.

val searchResultId = searchResponse.results.firstOrNull()?.searchResultId ?: return
val poiId = PoiId(searchResultId.id, searchResultId.source)

You can also provide an optional locale parameter, to define the language choice of the delivered results. For more information about the POI details request, go to the Search API Place by ID documentation.

1val poiDetailsOptions =
2 PoiDetailsOptions(
3 poiId = poiId,
4 locale = Locale("fr", "FR"),
5 )

After constructing the PoiDetailsOptions object, you can initiate a request as outlined in the section called Making Search API calls. The call returns a PoiDetailsResponse object, or a SearchFailure if the request was unsuccessful.

1search.requestPoiDetails(
2 poiDetailsOptions,
3 object : PoiDetailsCallback {
4 override fun onSuccess(result: PoiDetailsResponse) {
5 // YOUR CODE GOES HERE
6 }
7
8 override fun onFailure(failure: SearchFailure) {
9 // YOUR CODE GOES HERE
10 }
11 },
12)

Next steps

Since you have learned how to work with search poi details, here are recommendations for the next steps: