Facebook API Getting Friends of a friend - facebook

Good day, we are building an app that NEEDS to have information of user's friends' friends. For example: John logs into the app and he has 100 friends, each of those 100 friends also has 100 friends that equals to 10,000 people, application needs to get info like profile picture and basic info of those 10,000 people. We know that it was possible in the old API of Facebook, what happened now? If the current API doesn't have this function can we get exclusive access to this particular function for our servers only?

No, you can only access (non public) data about your app's users and their friends (subject to their privacy settings) - there's no permission which grants access to the friends of friends or their private data.

Related

Facebook GRAPH API - user's friends list does not return any data except total count

I created several test users in my App in Facebook developer account and granted all of them user_friends permission and also connected them together through 'Manage user's Facebook friends' option. However when I try to retrieve one of those user's friends list, it returns only total count of friend, but not their data .. Does anyone know why is that happening ? Thank you in advance..
Test users list
me/friends request and response
Granted permissions to test users
Its a known bug of Facebook which has been reported here for app type Consumer/Business.
https://developers.facebook.com/support/bugs/721152122632278/
https://developers.facebook.com/support/bugs/615773773588521/
But you won't have any issue if your app time is Gaming Service, or you create a test app of your main app but don't forgot to create test users, assign them 'user_friend' permission and add them as a friend with each other. I followed the same process after going through alot of research and finally it worked.

Facebook graph - get all user's friend's photos without going over limit

Facebook has a limit to allows 200 calls per user per hour (https://developers.facebook.com/docs/graph-api/advanced/rate-limiting). When my user logs in I need them to be able to get the profile pictures of all their friends and of course many people have more than 200 Facebook friends. So if I was to make a request I could only retrieve 200 pictures of that user's friends. I have seen apps where all my Facebook friends profile pictures show up (I have > than 200 friends on FB) so I was wondering how is this possible? How can an app get all the profile pictures of friends without going over the limit?
/me/friends?fields=picture&limit=100
This API call will get the profile pictures of 100 friends, and it´s only ONE API call. If there are more App friends, you can use paging to get the next 100 profile pictures. You don´t need to use a separate API call for each friend. It´s called "field expansion": https://developers.facebook.com/docs/graph-api/using-graph-api

get books read by friends using facebook api

the facebook profile of a user contains the user likes in form of movies,books,television etc. I want these details for a user's friend.For eg, if B is a friend of A, then the books read by B should be displayed when one logs in the app.
The list of friends returned via the /me/friends endpoint is now
limited to the list of friends that have authorized your app.
Source: https://developers.facebook.com/docs/apps/changelog
Facebook also removed all friend permissions, so you will not get the books of the friends in any case. This is mostly for privacy reasons.

Fetching list of friends in Graph API or FQL - Appears to be missing some friends

Any chance the 'me/friends' graph api or friends FQL table return some friends only?
I've checked the results and it's slightly less than the count I see on facebook.com
In Graph API V1.0
A call to /friends on a User object (e.g. /me/friends) or a query of the friend FQL table should return all friends of that user except
Those who have deactivated their accounts
Those who have blocked your app
Those who have disabled all Platform apps from accessing their data. - If a user enables this option (see below) you can't access any information about that user via the API, including their basic info, posts they make, etc. They won't appear in the friends list of your app's user via the API.
If you find friends are missing from the response it's almost certainly for one of those reasons, and in my experience most people asking this question are asking about the third case.
The option to remove platform option is currently under Privacy Settings -> Ads, Apps & Websites -> 'Turn off your ability to use apps, plugins, and websites on and off Facebook
If you're not getting all friends in a single call and you're sure it's not because of one of those reasons, check if you have a limit parameter in your query - and increase it if it's less than the number of friends you think should be appearing.
e.g. /me/friends?limit=5000 for the maximum number of friends allowed, 5000
Note that the friends count will include users which can't be retrieved in the list (e.g. the friend_count field of the User FQL table)
In Graph API V2.0 or higher
A call to /friends on a User object will, if the user has granted your app the user_friends permission, return the friends of that user who have also granted your app the user_friends permission -
You can read more about the change from v1.0 to v2.0 in Facebook Graph Api v2.0+ - /me/friends returns empty, or only friends who also use my app or on Facebook's changelog
You need to pass a limit parameter.
'me/friends/?limit=0' it will return all your friends.
UPDATE
the parameter limit=0 returns 0 friends,
to get all your friends, you need to set the limit=5000 (it's the max number allowed)
With the introduction of the Facebook Graph API 2.0, access a user's friends list was removed and limited to just friends who use the same application. However, Facebook added two new APIs to allow retrieval of Friend names (and indirectly a friend count). The two new APIs are taggable_friends and invitable_friends.
Url:
me/taggable_friends?limit=1&fields=id,name,

Getting friend user id, and their photos

I am doing some research into the capacity of Facebook Connect. I have some questions on how a couple of bits of functionality.
Is it possible to fetch a list of all friends of a user?
The idea of this is that a user would log in using my site and then they could search through their friends and select one, and the site would get that friends users id and store it to the sites database.
Getting a photos from that user
After getting the friends user id, would it then be possible to get their photos? Or would the friend need to give the site permission to do that?
I am looking into a site where you can buy a greetings card for a friend, and i wanted to know whether my users would be able to login via facebook, pick a friend, get a photo and then at the time of their birthday it would send them a private message (which i think i know how to do) linking them back to my site where they could view the birthday card and their photo.
Thanks
To answer your questions:
Yes. Once you have an access token from the login process for a user, make a Graph API request to https://graph.facebook.com/me/friends. You can test this for yourself here: https://developers.facebook.com/tools/explorer?method=GET&path=me%2Ffriends
Yes. During the login process, you must request user_photos and friends_photos permissions after which you can use the access token for a Graph API request to https://graph.facebook.com/USERID/photos. This will only return those photos for a friend which the user is allowed to see for the current privacy settings.