How to search for friends around me using Facebook API?
-
Using GraphAPI, I see you can request location of a specific friend, or search for friends by criteria. However, I couldn't find a way to search for friends in my area. I want to perform a search and get a results of friends who are in a radius of X meters from me. I know I can fetch each friend manually and check its location, but it seems a bit inefficient so I'm looking for a batch search, EDIT: I've found a similar question (and answer) using FQL: http://stackoverflow.com/questions/6947647/facebook-fql-query-similar-to-friends-checkins
-
Answer:
Well, you partly answered yourself there... When you query about a user friend, you get his location as well since it's part of the User object (assuming you have the right permissions of course): http://developers.facebook.com/docs/reference/api/user/ The problem, as you wrote, is that you'll need to send a request to facebook per friend, which is not the right way to go about this. Thankfully, facebook already thought of that and they came up with the "Batch Requests": http://developers.facebook.com/docs/reference/api/batch/ which let you do exactly that. EDIT Now that I think of it, it's simpler than I wrote before, you don't even need the batch requests since you can get all of the user friends in one request to: me/friends. Assuming you have the user granted you the needed permissions each user object in the friends list will have the location object as well. For each friend calculate if his location is in the desired radius.
Gilad at Stack Overflow Visit the source
Related Q & A:
- How To Search For Friends?Best solution by Web Applications
- How to Implement Gateway Service something similar to Oracle API gateway Using Java and Java based Open Source frameworks only?Best solution by Quora
- How to reply to particular tweet using Twitter API?Best solution by Stack Overflow
- How can i search for friends on yahoo?Best solution by Yahoo! Answers
- How can i search my friends?Best solution by Yahoo! Answers
Just Added Q & A:
- How many active mobile subscribers are there in China?Best solution by Quora
- How to find the right vacation?Best solution by bookit.com
- How To Make Your Own Primer?Best solution by thekrazycouponlady.com
- How do you get the domain & range?Best solution by ChaCha
- How do you open pop up blockers?Best solution by Yahoo! Answers
For every problem there is a solution! Proved by Solucija.
-
Got an issue and looking for advice?
-
Ask Solucija to search every corner of the Web for help.
-
Get workable solutions and helpful tips in a moment.
Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.