Getting locations of user's friends with Foursquare API - foursquare

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.

Related

How to sort posts list based on different sorting criteria in mongodb?

I am building social network app. i have used node.js(express) and mongodb as backend.
Now, i want to list all posts based on different sorting critrea.
user can set his business category(optional). i have store each user current location in user documents.
Now, i need the post list of all user including friends based on below sorting criteria
post from near by friends (lowest distance first)
post from user who has same category as logged in user if logged in user has set business category
post from user who has different business category
post from user who has not set business category (latest first(created at desc))
how should i build structure for friend system in order to achieve above sorting posts?
Any help would be appreciated.
Thanks
First you should pay attention to the memory - this structure grows with N^2 speed where N - posts count.
This task seems to be quiet complex so I suggest to add some logic on backend.
For example, look at CQRS+ES (I think it's suitable technology in your case). So, posts are events and you would have sorted list for every user on read side. And you would update all these structures on every post. (You can read about CQRS here http://cqrs.nu/ and check simple CQRS framework with express support here https://reimagined.github.io/resolve )
In addition I recomend you to limit posts count for every users' list.

Similar venues with location foursquare API

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

Get list of venues of whole city

How I can receive all venues in city (for example, in Moscow).
I am trying to get list of all venues via https://api.foursquare.com/v2/venues/explore?near=Moscow,Russia&radius=20000&limit=50&&offset=0&client_id=clid&client_secret=clsecret&v=20160307
http requsts by changing offset parameter, but totalCount of venues in result list is 249 (for Moscow it is small).
So, is it possible to get list of all venues for so huge city as Moscow?
It is neccesary for my bachelor work, I write a reccomendation system for building tourist routes and only foursquare service have a extensive database with cafes, museums and monuments.
Thanks

How to increase Foursquare Venue limit for getting all restaurants from Foursquare Venue API?

I am calling Foursquare Venue API for getting all food venues of London.
Used API is: https://api.foursquare.com/v2/venues/explore?ll=51.51121389999999,-0.11982439999997041&section=xxxx&**limit=11000**&oauth_token=xxxx
It returns always random 100 venues. If I call it next time then it returns same venues instead of unique 100 venues.
How to get unique records for getting all venues? How to get all venues by increasing the limit?
The maximum number of venues returned in an explore query can be found in our documentation: https://developer.foursquare.com/docs/venues/explore
Getting all the food venues in any geographic region isn't really something the Foursquare API is designed to do, but you can get different results if you modify your ll and/or radius params. Please keep in mind our developer policies against scraping though if you choose to do a sweeping approach.

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.

Resources