Find mutual friends in facebook using Graph API - facebook-graph-api

I want to find the number of mutual friends between two of my friends. Is it possible and what permissions i should tick to get this access token?
I used following query in Graph API Explorer:
id1/mutualfriends/id2
It returns mutual friends between me and id2. But i want mutual friends between id1 and id2. Both id1 and id2 are my friends.What is the right format of query if it is possible?
If anyone know about it please response.

Related

Facebook API v6.0 to find mutual friends

With the most recent version (6.0) of the Facebook Graph API, there are no longer endpoints to find mutual friends between two users or get the friends list of a user.
If I want to find the number of mutual friends of two users on my app, how would I go about doing so? I can get the number of mutual friends who are also using the app (https://developers.facebook.com/docs/graph-api/reference/user/friends/), but what if I want to get the total number of mutual friends?
You can’t do that any more.
https://developers.facebook.com/docs/graph-api/changelog/version3.1#mutual-friends-api:
Mutual Friends API
These changes apply to v3.1+, and will apply to all versions on October 24, 2018.
The Mutual Friends API was deprecated on April 4, 2018, and the endpoints below started returning empty data sets. The endpoints are now fully deprecated and will return an error.
/user-context/all_mutual_friends
/user-context/mutual_friends
/user-context/three_degree_mutual_friends
This has been removed for good, and there is no current replacement.

Facebook Graph API getting friends

I am using the FB graph api to get a list of my friends' friends using:
https://graph.facebook.com/<id>/friends?access_token=<token>
Now the weird thing is that this works for some of my friends and does not work for some others. Could somebody tell me why this is happening and a possible fix?
In cases where it does not work, I get the following message: "Can't lookup all friends of YYYYYY. Can only lookup for the logged in user (XXXXX), or friends of the logged in user with the appropriate permission"
And I repeat, I AM ABLE to get friend lists of some of my friends using the above URL. What permissions are being mentioned here?
In new SDK of the Graph API is not possible to do that.
Take a look here.

Facebook Graph API Query: Find all friends of a certain gender

I'm working on moving my app's code from Facebook's deprecated FQL to the graph API. Overall, the API makes a lot of sense thanks to the graph explorer tool. I've been able to figure out how to make general queries such as getting all my friends (and each friend's gender, first name, last name, and profile picture):
https://graph.facebook.com/v2.2/me?fields=friends{gender,first_name,last_name,picture}
The main issue I'm running into is figuring out how to make my query more specific. What I really want to do is get all my friends who are females. How would I go about specifying a desired 'gender' here? Is this even possible? Thanks for your help.
Filtering via query is not possible with the current version of the Graph API. You'll have to filter the result of your request in your application unfortunately.

How do I compare two facebook UIDs to determine if they are friends?

i have authenticated users using devise and omniauth facebook gem in my rails 3.2 app. How can i determine if two users are friends based on their uid only? Is it better to use Facebook query language or some other means? please provide an example
You can do this using the Graph API by checking /me/friends/USER_ID_TO_TEST or FQL with SELECT uid1, uid2 FROM friend WHERE uid1 = me() and UID2 = USER_ID_TO_TEST
One of the two users has to be authenticated at the time or the query will fail.
The problem with this is that if the users are not friends, Facebook will return an empty data set. If you don't like that, then you need to retrieve a user's list of friends into your script and search the response for the friend to test.

Facebook API retrieving FriendList Object and subsequently friends from each friendlist

I am using Facebook graph (rest) API, and I'd like to retrieve facebook FriendList object of a certain user, and then I'd need to retrieve friends from a particular FriendList. I have looked into facebook API documentation but I don't understand what is FRIENDLIST_ID and how am I suppose to know the ID. Please if someone has done it before please help me out.
FRIENDLIST_ID/members returns the members.