Facebook API - Mutual Friends

2.5k Views Asked by At

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

2

There are 2 best solutions below

4
Tobi On BEST ANSWER

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.

2
cduguet On

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