Similar venues with location foursquare API - foursquare

I am playing with Foursquare API and I was wondering if theres an endpoint for getting a similar venue in a location given another venue?
All I found is this endpoint:
https://api.foursquare.com/v2/venues/VENUE_ID/similar
Which returns a list of venues similar to a given venue. What I want is, exactly this but I want the returned venues be close to a given location.
For example:
I love a mexican restaurant in London.
I want to find a similar restaurant but in Barcelona.
Is that possible?
Thanks!

The venues/similar endpoint will only show similar venues near the desired venue. Your best bet is probably using the query parameter with venues/explore. The query parameter is pretty smart about determining your intent if you know what you're looking for and you can specify any location.
i.e.
https://api.foursquare.com/v2/venues/explore?
query=Mexican food outdoor seating
near=Barcelona

Related

FourSquare vs. Google Places vs. Yelp API

I am trying to create an app that will help users find restaurants/movie theaters/malls/etc. to hang out based on ratings and distance. Other than just the place itself, I would also like to know more detailed information about the place. For example, if I were to look for parks, I would also like to know if theres a basketball or tennis court there. Ratings and popularity would also be an important aspect to prioritize suggestions.
After looking through all three of the APIs, I could not really find any substantial differences other than their search limits. Could anyone really differentiate each API for me? Maybe even recommend one based on my specific need?
Thanks!
The Foursquare API would fit this use case perfectly because you can supply very specific filters through the API. Also, they have extensive coverage around the world, unlike Google or Yelp.
I would check out the venues/explore endpoint and use a categoryId of Parks. You can use a query parameter of "basketball" or "tennis" to find parks that have courts for these.

Cannot find restaurant using /venue/search end-point

Question to Foursquare engineers :) Could you please explain to me why I cannot find restaurant using /venue/search end-point ?
Restaurant in question is Aqua in San Francisco. According to /venue/ID request restaurant location is 37.793489,-122.399905. So I'm calling /venue/search request with intent=checkin with exactly these coordinates.
https://api.foursquare.com/v2/venues/search?v=20130712&ll=37.793489,-122.399905&categoryId=4d4b7105d754a06374d81259,4d4b7105d754a06376d81259&intent=checkin&radius=100&oauth_token=QEJ4AQPTMMNB413HGNZ5YDMJSHTOHZHMLZCAQCCLXIX41OMP
API returns me 30 items with no Aqua in it. Where as in documentation it says:
Unlike the checkin intent, browse searches an entire region instead of only finding Venues closest to a point.
So then why doesn't it return items sorted by the distance from the point I provided?
If I change intent to browse I'll get "Aqua" in results.
Basically behavior looks inconsistent. How can I make it more reliable ?
It looks like this is happening because this isn't a venue that Foursquare thinks you're likely to check in at. Given your lat/lon and radius, Foursquare thinks that you're more likely to check in to the 30 results you see than the restaurant you have in mind.
However, if you either reduce the radius or increase the number of results, you'll find the restaurant in question.

How does foursquare's nearby friends functionality work?

I'm working on a location rating functionality that uses the foursquare API, and would like my result to be based on the user's current region. The same way Foursquare divides users in the nearby friends. Does Foursquare use a certain radius based on your location? And if they are, what radius is it?
Foursquare considers a friend to be in the "same city" as you if the friend is within 40 kilometers.

Foursquare API: Search venues in whole city

Is it possible to search venues (via venues/search) in whole city without passing "radius" parameter? Because I don't know radius of each city :) Documentation says "Searches can be done near a point or through a whole city", but how can I provide this in venues/search?
Thanks.
I do not think there is a way to tell it 'search the entire city', but I also think it might be a wrong use case.
You need to remember a few things when searching:
Foursquare will return up to 50 results (the limit parameter)
The 50 results are ordered by the most popular places around the center of your search
So if you are searching a city which have more than 50 venues in Foursquare database, 'searching the entire city' will usually get the same (up to) 50 results - always.
This where the filters comes in handy, in our case, to get you better results for our needs, we use the categoryId combined with the radius to get things we want to show our users. Sometimes we get information from other cities because of a big radius, but for our application its okay, we actually give our customers more options :) . I can also guess that a lot of apps also use the query filter as they know the name of the place they are looking for.
You just need to experiment with it and discover how to get the data which is right to your application.
In theory, to search an entire city I would use the city lat/lng from Google or Open Street Maps or geonames and do a 10Km search around that point (intent=browse, radius=10000), the following is a guess, but it will get 50 places for over 99% of the cities people who own smartphones live in :)
You can do obtain results within in a city as follows:
https://api.foursquare.com/v2/venues/search?near=Singapore,Singapore&client_id=YOUR_CLIENT_ID
&client_secret=YOUR_CLIENT_SECRET3&v=YYYYMMDD
For more details check the documentation:
https://developer.foursquare.com/docs/venues/explore
Assuming you're talking about requests with a query, I would just set a reasonable value for radius and use the city's default city center. If you want to avoid showing results from neighboring cities, you can post-request filter by the returned venue's "city" string in the location stanza.

Getting locations of user's friends with Foursquare API

Is it possible to get the nearby locations of a user's friends, or, when searching for nearby venues, determine how many friends are present at each of the venues?
In other words, I would like to list all nearby venues along with a count of friends here now. Can this be done without making venue detail calls on all of the venues?
Friend information is not currently accessible via the /venues/search endpoint -- only the total number of users at the venue.
As you mentioned, you can call the /venues/VENUE_ID/herenow endpoint to get more information (including friend vs. non-friend) breakdowns for the returned venues.
You can, alternatively, make a single call to /checkins/recent and combine the data about current friend location with /venues/search results.

Resources