Search code examples
foursquare

Foursquare venue score/rating


Does anyone know how I can get a venue's score/rating (e.g. 9.0/10) using the Foursquare API?

I am connecting via Userless Access. https://developer.foursquare.com/overview/auth#userless

The JSON blob that I get when I request venue details does not seem to include the score/rating. https://developer.foursquare.com/docs/venues/venues


Solution

  • It is worth noting, first of all, that not all venues have ratings. A rating is only calculated in certain situations, like if there is enough sentiment data about a venue to start calculating a rating and if the venue is not a user's home.

    However, if a venue does have a rating calculated and you're making a request with a recent version of the API (make sure you have a v param set from within the last few months), it will be returned in the JSON from the API as follows, when you make a call to /venues/<ID>:

    {
      response: {
        venue: {
          ... // Other data about the venue will surround this, of course
          rating: 7.18
        }
      }
      ... // The response's metadata will also be here
    }
    

    So, basically you want to check response.venue.rating.