user1177292
user1177292

Reputation: 273

Graph API limit on friends / events returned

I am using the following to get friends via my Android app

Bundle params = new Bundle();
params.putString("fields", "id,name,birthday");
Utility.mAsyncRunner.request("me/friends", params, new EventsRequestListener());

I have been looking over the docs and cannot find any details about how many friends will be returned. Can I pass in a limit parameter such as 500? or this standard across all the api calls?

Upvotes: 0

Views: 1500

Answers (3)

David Burke
David Burke

Reputation: 21

I ran into the same problem as the OP with the accepted answer. The way to get around the API adding the ? is to set the limit as one of your parameters.

Bundle params = new Bundle();
params.putString("limit", "10");
Utility.mAsyncRunner.request("me/friends", params, new EventsRequestListener()));

When it creates the URL it will add the "&limit=10" correctly after the access token

Upvotes: 2

Venky
Venky

Reputation: 11107

You can use https://graph.facebook.com/me/friends?limit=5 or

Utility.mAsyncRunner.request("me/friends?limit=5", params, new EventsRequestListener());

You can check your friends limit using Graph Explorer :

Graph Explorer

Click on Graph API , then add your query inside Edit Text and you should pass Access token into this , so Get Access token by clicking GetAccess Token Button. It will ask for option select Friends Data Permission , then you will get Access token then add your query to check your result.

Upvotes: 2

ρяσѕρєя K
ρяσѕρєя K

Reputation: 132972

yes you can pass limit by add ?limit=5 as :

Utility.mAsyncRunner.request("me/friends?limit=5", params, new EventsRequestListener());

for more deatils see Graph API

Upvotes: 0

Related Questions