Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Facebook graph API 'friends' request now only returning 25 friends per page? What's going on?

My application(game) has been running on Facebook for some time. I start by requesting a friends list via the graph API call: my-uid/friends asking for user name and profile pic.

Normally I get back a list of all my friends up to a few thousand, until it starts putting friends on to the next page. Which is nice as most of my users get friends in 1 call.

Suddenly however, and with no changes to the app. about 40 minutes ago (18:40 Tuesday (PDT) - 2nd May 2012) I started getting responses with only 25 friends per 'page'!

I can still get my whole friends list using multiple calls, but the game is not currently set up to do that properly. Can anyone tell me why the sudden change? Anyone else seen similar problems and how do I get the list to give me up to 5000 friends per page like it used to.

Reproducible using the Graph API Explorer

like image 801
Paul Naylor Avatar asked May 02 '12 02:05

Paul Naylor


People also ask

What happened to Facebook graph search?

In early June 2019, the feature was further deprecated, with the majority of URLs for graph search queries no longer working. Facebook explained this by saying: "The vast majority of people on Facebook search using keywords, a factor which led us to pause some aspects of graph search and focus more on improving keyword ...

Is Facebook Graph API deprecated?

Applies to all versions. Facebook Analytics will no longer be available after June 30, 2021. Additionally, we are deprecating the App Dashboard Plugin for Marketing API. For more information visit the Business Help Center.

How do I update my graph API on Facebook?

In the App Dashboard Settings > Advanced, scroll to the Upgrade API Version section.

Is Facebook Graph API RESTful?

The Legacy REST API is in the process of being deprecated, while the Graph API is the most current, so if you're unsure of which one to use, your best bet is to go with that one. As you suggested, the Graph API, just like the Legacy REST API, is in fact a RESTful API.


2 Answers

In SDK 4.7 you need to pass in a bundle with the number of friends you want to return, I have set it to 5000 as this is the maximum number of friends you can have on Facebook.

You also need to set up your app as a game in the facebook dev console and use invitable friends to get a full friends list

Create your bundle

Bundle bundle = new Bundle();

Add params to your bundle

bundle.putInt("limit", 5000);

Then pass it in to your GraphRequest

new GraphRequest(
            AccessToken.getCurrentAccessToken(),
            "/me/invitable_friends",
            bundle,
            HttpMethod.GET,
            new GraphRequest.Callback() {
                public void onCompleted(GraphResponse response) {
                   //Do something with the response
                }
            }
    ).executeAsync();
like image 197
MichaelStoddart Avatar answered Sep 21 '22 12:09

MichaelStoddart


I don't know what else to tell you; perhaps the default number returned has changed, but when I try, a call to /me/friends?limit=5000 returns the full list for me (but my friends list is >500 and < 1000 , so maybe it cuts off somewhere along the way)

(Side note: the average number of friends has been found to be ~190 so presumably most users will have less than 500 anyway, and having to page above 500 would be an edge case

like image 24
Igy Avatar answered Sep 23 '22 12:09

Igy