If you use Foursquare's API venues/explore to get venues in a certain area, you get in the response the number of photos. For example, the default query generated when you press the "Try It" button in the API documentation:
https://api.foursquare.com/v2/venues/explore?ll=40.7,-74
Gives something like:
<...>
venue: {
id: "4de1b34ec65b7a3e2109e46f",
name: "Beekman Beer Garden",
<...>
photos: {
count: 371,
groups: [ ],
}
But no photo URL of the venue.
If you try the venues/photos to retrieve the photos of this venue, you get a full list of photos:
https://api.foursquare.com/v2/venues/4de1b34ec65b7a3e2109e46f/photos?group=venue
Response:
<...>
id: "4fecf72ae4b0f9f20ef5f4ae",
<...>
prefix: "https://irs0.4sqi.net/img/general/",
suffix: "/Ch8l3fTBYzszVoOiDcWoklClo9wbWseLr2ZXBbde4es.jpg",
<...>
id: "4fecd642e4b0f3117eb4d2e3",
<...>
prefix: "https://irs1.4sqi.net/img/general/",
suffix: "/kWzECY2VMssTWex1GNZITP-YlWzWDHZYsV5p2k4tsEk.jpg",
<...>
As you can see, there are a lot of public photos for the venue.
The venues/explore API seems to include the url of a photo in some rare cases. Why is that? Is there a way of getting a photo for each venue using /explore, not /photos?
There is a way to get a (singular) photo via the explore endpoint. You have to add the venuePhotos parameter to your call with a value of 1. Example:
https://api.foursquare.com/v2/venues/explore/?near=austin&venuePhotos=1&client_id=CLIENTID&client_secret=CLIENTSECRET&v=20131124
Photos are returned as part of the venue JSON object.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With