Sorry, you need to enable JavaScript to visit this website.

POI Details & POI Photos

POI Details & POI Photos

The Points of Interest Details endpoint allows you to provide more useful information about POIs in your app with additional details. As you can see in the documentation of the Points of Interest Details endpoint (Points of Interest Details) the information it provides includes:

  1. Current Rating

  2. Price Range

  3. 5 to 10 most relevant user reviews

  4. Social Media details (Facebook, Instagram and Twitter), if available

  5. The Photo IDs that can be used in order to fetch images related to given POI

This is what you need to do to get the details of a POI:

  1. Search for a POI using any of the POI search endpoints including Fuzzy Search, Geometry Search, or Along Route Search (see SEARCH API reference. ) → The Response includes a POI ID for each POI in the results.

  2. Call POI Details with the POI ID for the place you want to get details of → The response include rating, priceRange, socialMedia, photos IDs, or reviews.

  3. Done! You can use these details in your app to provide more information about places.

The Points of Interest Photos endpoint provides photos of the POI.

This what you need to do to get photos of POIs:

  1. Search for a POI using any of the POI search endpoints including Fuzzy Search, Geometry Search, or Along Route Search (see the Search API reference) → The Response includes a POI ID for each POI in the results.

  2. Call POI Details with the POI ID for the place you want to get photos of. The Response includes up to 5 photo IDs.

  3. Call POI Photos with the Photo ID for the place you want to get photos of.

  4. Done! You can display a photo of the POI you need.

For more details and background, have a look at the detailed documentation of the POI Photos endpoint.

Sample use case: You would like to plan a trip to Amsterdam, find a pleasant hostel, and choose a pizza restaurant in that neighborhood. Thanks to the Points of Interest Details endpoint, you are provided with information including pricing ranges, ratings, reviews, social media details, and contact information. Thanks to the Points of Interest Photos endpoint, you can have a look at photos to feel the atmosphere of the places. Foursquare provides dozens of updates every day, so you can count on accurate and reliable information.

Important: You shall attribute all results delivered by the Extended Search API Points of Interest Details endpoint and Points of Interest Photos endpoint as being "powered by Foursquare".

Use the following code snippets to try this in your app.

First, create a service:

_

SearchApi searchApi = OnlineSearchApi.create(context, BuildConfig.SEARCH_API_KEY);
private val searchApi = OnlineSearchApi.create(context, BuildConfig.SEARCH_API_KEY)

Then using our Search API endpoints obtain POI objects:

val fuzzyLocationDescriptor = FuzzyLocationDescriptor.Builder()
    .positionBias(LatLngBias(Locations.AMSTERDAM))
    .build()
val fuzzyTimeDescriptor = TimeDescriptor(OpeningHoursMode.NEXT_SEVEN_DAYS)
val fuzzySearchEngineDescriptor = FuzzySearchEngineDescriptor.Builder()
    .limit(50)
    .build()
val fuzzySearchSpecification = FuzzySearchSpecification.Builder(term)
    .locationDescriptor(fuzzyLocationDescriptor)
    .searchEngineDescriptor(fuzzySearchEngineDescriptor)
    .timeDescriptor(fuzzyTimeDescriptor)
    .build()
search(fuzzySearchSpecification)

Then based on AdditionalDataSources in FuzzyDetails you need to find the Foursquare data source and grab its ID.

val poiId = fuzzyDetails.additionalDataSources?.poiDetailsDataSources?.first()?.id

Based on that ID you need to get the given data source details:

val poiDetailsSpecification = PoiDetailsSpecification(id)
searchApi.poiDetailsSearch(poiDetailsSpecification)

If you want to get photos of a given POI:

val poiSpecifications = listOfIds.map { photo -> PoiPhotoSpecification.Builder(photo.id).build() }
        searchApi.poiPhotoDownload(photo)

Screen shots presenting how the POI Details service works:

image