9

new 2.0 version has a paging that limit the numbers of friends at one request, which doesn't allow me to retrieve all friends at once although there's a parameter call 'limit', it can only be done by looping the 'offset' till the end. The problem is each user has different number of friends!

I've been looking around for few hours but still don't have a solution..

user3522457
  • 2,845
  • 6
  • 23
  • 24

1 Answers1

29

As mentioned in the Graph API v2.0 upgrading guide (https://developers.facebook.com/docs/apps/upgrading#upgrading_v2_0_user_ids)

/me/friends returns the user's friends who are also using your app In v2.0, the friends API endpoint returns the list of a person's friends who are also using your app. In v1.0, the response included all of a person's friends.

There are two key use cases where apps need access to non-app friends: tagging and inviting. In v2.0, we've added the Taggable Friends API and the Invitable Friends API to support these flows.

After a person has logged in with v2.0 of Facebook Login, calling /v1.0/me/friends and/v2.0/me/friends` will both result in the v2.0 behaviour - both calls will return the set of the person's friends who also use the app.

So, in v2.0 you'll only be able to get all friends via the /me/taggable_friends (https://developers.facebook.com/docs/graph-api/reference/v2.0/user/taggable_friends) endpoint, which only contains the fields id, name, picture, and only can be used after a review of your app by Facebook.

Tobi
  • 31,405
  • 8
  • 58
  • 90
  • 11
    You should be aware the even after a review and permission to use taggable_friends, the IDs you get back can only be used to tag friends - you can't use those IDs to get any other information about a user. Users must have used your app and given it permissions for you to request any information about them. – giff May 07 '14 at 20:13
  • But he was just referring to the friends list, not using friends permissions – Tobi May 08 '14 at 07:27
  • 2
    How to handle these new (probably encoded) friend ID's ... retrieving larger picture for example ? – Radoslav May 18 '14 at 11:11
  • Example code of retrieving friends and tagging them can be found here: https://www.webniraj.com/2014/06/12/facebook-api-getting-friends-using-graph-api-2-0-and-php-sdk-4-0-x/ – Niraj Shah Jun 19 '14 at 10:23
  • @Tobi, Yes I am able to get all my friends with tagged token id, but now how can I use those tokens for tagged friends in sharing in iOS app. – Jagdev Sendhav Jun 27 '14 at 09:07
  • Is there any way to send personal messages to a list of taggable friends ? to get username or id of friends ! – P-RAD Apr 17 '15 at 09:47
  • I tried the endpoint `/me/taggable_friends` in Graph Explorer and it returns empty data. It is a recent change from Facebook: https://stackoverflow.com/questions/23417356/facebook-graph-api-v2-0-me-friends-returns-empty-or-only-friends-who-also-u#comment86580231_23417628 https://developers.facebook.com/docs/graph-api/changelog/breaking-changes/#taggable-friends-4-4 So there is no way to get my own friends list using the API? – baptx Feb 04 '20 at 09:34