0

Is there a way to retrieve a list of mutual friends between /me/ and a certain {facebook id}

I thought this was possible with 1.0, but am wondering if it can still be done with 2.0

Ken Y-N
  • 14,644
  • 21
  • 71
  • 114
MikeSig7
  • 37
  • 1
  • 5

2 Answers2

2

There is a way in which you could get access to all mutual friends (not only the ones using yout app) in API v2.

There is a special request. This is the detail:

All Mutual Friends API

The All Mutual Friends API gives you access to all the mutual friends between two people who use your app. The response includes mutual friends who use your app as well as limited information about mutual friends who don’t use your app.

Common Usage

Display social context between the person using your app, and another app user

Use the token returned for non-app mutual friends to link to that person's Facebook profile

Surface the mutual friends of two people who use your app to anyone other than those to people

Store the names and profile pictures of the mutual friends

Any non-visible use of this information, for example for recommendations and ranking

Here's the link:

https://developers.facebook.com/docs/apps/review/feature#reference-ALL_MUTUAL_FRIENDS

cduguet
  • 442
  • 3
  • 21
1

Yes, this is possible. Graph API v2.0 introduced a new endpoint

GET /{user-id}.context/mutual_friends

which is described at https://developers.facebook.com/docs/graph-api/reference/v2.1/user.context/mutual_friends

There's a summary.total_count field in the result of the call which contains the number of mutual friends.

Tobi
  • 31,405
  • 8
  • 58
  • 90
  • I am using the Graph API Explorer and entering: /v2.1/1191167455?fields=context.fields(mutual_friends) It is giving me the following error: { "error": { "message": "The global ID 1191167455 is not allowed. Please use the application specific ID instead.", "type": "OAuthException", "code": 2500 } } – MikeSig7 Sep 26 '14 at 12:18
  • When I use Mark Zuck's facebook id: /v2.1/4?fields=context.fields(mutual_friends) It displays: { "context": { "mutual_friends": { "data": [ ], "summary": { "total_count": 0 } } }, "id": "4" } – MikeSig7 Sep 26 '14 at 12:21
  • If you're using Graph API >=v2.0 then you need to use app-scoped ids. In the graph Explorer, change to one of your apps (pulldown in the upper right corner) which are >=v2.0 and retry. And, make sure to read the permission part of the docs I linked above. – Tobi Sep 26 '14 at 12:34
  • I'm sorry...I don't understand how to use scoped ids. Can you write a sample url that I can test in the Graph Explorer that will pull mutual friends with user id 1191167455 – MikeSig7 Sep 26 '14 at 13:19