user1463862
user1463862

Reputation: 101

Foursquare: Photos on venues/photos but not on venues/explore?

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?

Upvotes: 9

Views: 6783

Answers (2)

Sullivan
Sullivan

Reputation: 161

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.

Upvotes: 11

akdotcom
akdotcom

Reputation: 4687

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.

Upvotes: 1

Related Questions