9

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?

user1463862
  • 101
  • 1
  • 4

2 Answers2

11

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.

Sullivan
  • 161
  • 1
  • 8
  • thank you, been trying to figure out how to only get one photo with userless access. – sudo Mar 06 '14 at 21:36
1

There's no single call to retrieve a searched set of venues + photos.

/venues/search only returns a photo count.

/venues/explore often returns a photo (either as part of the venue or as part of a tip associated with the venue).

For venues that don't have an associated photo from /venues/explore, you'll need to call /venues/VENUE_ID/photos for photo information.

akdotcom
  • 4,497
  • 2
  • 15
  • 16
  • Thank you for the reply, akdotcom. Do you know how often the "often" is? What are the criteria to have a photo or not with /venues/explore? – user1463862 Jul 03 '12 at 06:51
  • 1
    I don't know how often "often" is. The presence of a photo is mostly dependent on how many high quality tips at the venue have a photo associated with them. – akdotcom Jul 03 '12 at 16:06