Foursquare: Photos on venues/photos but not on venues/explore?
Asked Answered
W

2

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?

Wailoo answered 29/6, 2012 at 1:22 Comment(0)
R
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.

Rohn answered 24/11, 2013 at 22:24 Comment(1)
thank you, been trying to figure out how to only get one photo with userless access.Firebug
M
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.

Merv answered 2/7, 2012 at 21:29 Comment(2)
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?Wailoo
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.Merv

© 2022 - 2024 — McMap. All rights reserved.