0

I know how to get friends using my app using Graph API:

me/friends returns the list of friends using my app.

I also know how to check if two friends have any mutual friends, too (I've asked this question before: Determining if two app using users have any mutual friends in Graph API 2.0/2.1?):

{user_id}?fields=context.fields(mutual_friends) returns my mutual friend count and list of mutual friends using the app.

However, I need a list of friends of friends who use the app. I can first get all my friends (the first query above) and check if I have mutual friends with them by querying the second endpoint that I've provided above for each user. But for example, if I have 50 friends on my app, it means querying Facebook 50 times, which is definitely not an acceptable behavior. I have privacy settings in my app which contains "friends of friends" option. How can I get all friends of friends using my app in a single query (or at least, not an O(n) query).

Community
  • 1
  • 1
Can Poyrazoğlu
  • 33,241
  • 48
  • 191
  • 389
  • 1
    You can't get all friends of friends in an API call. But when a person logs in get their friends. And then store that and query that when you need FoF. – WizKid Jan 23 '15 at 16:33
  • @WizKid but what about when user adds/removes friends, or friends that were previously not using the app start using the app? when should I "refresh"? – Can Poyrazoğlu Jan 23 '15 at 17:55
  • When someone new logs in to your app you would get all that persons friends. So the only problem is if someone because friend with someone that is already using the app. And for that you just have to get all friends when you need it – WizKid Jan 23 '15 at 18:36

0 Answers0