How to get whole Facebook friends list from api
The friendlists endpoint is deprecated, as you can see in the breaking changes log: https://developers.facebook.com/docs/graph-api/changelog/breaking-changes#tagged-users-4-4
It would not have been what you expected anyway, it was only for lists, not friends directly. Access to all friends is not possible since a very long time. You can only get data of users/friends who authorized your App. You can use the /me/friends
endpoint for that.
Another thread about getting all friends: Facebook Graph API v2.0+ - /me/friends returns empty, or only friends who also use my application
How do I get friends list from FaceBook?
The correct API endpoint to get the friends of the authorized user is /me/friends
and you need to authorize with the user_friends
permission. Keep in mind that you will only get friends who authorized your App with user_friends
too.
You can ONLY get access to ALL friends for tagging (with /me/taggable_friends
) or inviting friends to a game with Canvas implementation (with /me/invitable_friends
).
More information: Facebook Graph Api v2.0+ - /me/friends returns empty, or only friends who also use my app
Facebook API - Friend List
This would be the API: https://developers.facebook.com/docs/graph-api/reference/user-context/all_mutual_friends
There is no way to get friends (or users in general) who did not authorize your App. Every list you get will only include users who authorized your App.
Getting facebook friends list
$request = new FacebookRequest(
$session,
'GET',
'/me/friends'
);
$response = $request->execute();
$graphObject = $response->getGraphObject();
For example in CodeIgniter I use fb library and i get friends list like this:
public function get_user_friends() {
if ( $this->session ) {
try {
$fr = new FacebookRequest( $this->session, 'GET', '/me/friends' );
$request = $fr->execute();
$user_friends = $request->getGraphObject()->asArray();
return $user_friends;
} catch(FacebookRequestException $e) {
return false;
/*echo "Exception occured, code: " . $e->getCode();
echo " with message: " . $e->getMessage();*/
}
}
}
And dont forget that it has some conditions:
Permissions
A user access token with user_friends permission is required to view the current person's friends.
This will only return any friends who have used (via Facebook Login) the app making the request.
If a friend of the person declines the user_friends permission, that friend will not show up in the friend list for this person.
More about: https://developers.facebook.com/docs/graph-api/reference/v2.2/user/friends
getting list of friends from facebook
Those websites are probably using older Apps with v1.0 - it will stop working for them after end of April 2015. You can only use v1.0 with an App created before end of April 2014.
Empty test user friend list from Facebook Graph Api
I found what was the error, my app was with type "Consumer", when i removed the type i could make the request and receive the correct return from the Graph API.
But why it wasn't working with type "Consumer" i don't know, on the documentation it says this type has the permission ¹ but is really not working.
Related Topics
How to Directly Rotate Cvimagebuffer Image in iOS 4 Without Converting to Uiimage
Using Cabasicanimation to Rotate a Uiimageview More Than Once
Changing View Controller When Segmented Control Changes
How to Properly Order Data from Firebase Chronologically
Uitableviewcell Set Selected Initially
How to Remove Special Characters from String in Swift 2
@Property/@Synthesize Equivalent in Swift
Skspritenode - Create a Round Corner Node
iOS 14 How to Trigger Local Network Dialog and Check User Answer
Memory Leak Every Time Uiscrollview Is Released
Uitableviewcell Imageview Changing on Select
iOS - Push Viewcontroller from Code and Storyboard
Firebase Limit on the Number of Observers/Listeners
Swift/How to Use Dispatch_Group with Multiple Called Web Service
How to Draw a Single Point Line in iOS
Create and Perform Segue Without Storyboards
Xcode 6 Upload App with Error: Itunes Store Operation Failed Error Description Not Available