Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does the /me/friends Facebook open graph API call ever get paginated?

I'm testing my app based on a friend list of about 350 people, and not seeing any pagination on /me/friends/.

What's unclear to me (by testing & documentation) is the following:

At how many friends do the graph.facebook.com/me/friends or graph.facebook.com/ID/friends open graph calls starts to paginate, if at all?

like image 555
Mike Jarema Avatar asked May 16 '12 19:05

Mike Jarema


People also ask

How does Facebook do pagination?

Time-based PaginationTime pagination is used to navigate through results data using Unix timestamps which point to specific times in a list of data. To get all a users posts you keep iterating back in time.

What data can you get from Facebook API?

Facebook API is a bundle of solutions used as a primary way to get data in and out of the platform. It enables developers and app users to access the functionality of this network: user information, photos and videos, messages and more.

How do I test my graph API on Facebook?

Try executing the default query that appears when you first load the Graph API Explorer. If you haven't already, open the Graph API Explorer in a new window, select the app you want to test from the application dropdown menu, and get a User access token.

How can I use Facebook Graph API and extract data using PHP?

PHP Code to Read Facebook DataThis code uses PHP file_get_contents() function to read Facebook data from server. This function will return JSON array which will be decoded to display to the user. <? php if (isset($_POST["submit"])) { $url = $_POST["profile_url"]; $facebook_data = file_get_contents($url .


2 Answers

look at Graph API Explorer: https://developers.facebook.com/tools/explorer?method=GET&path=me%2Ffriends and scroll to the very bottom - you will there something like:

"paging": { "next": "https://graph.facebook.com/me/friends?format=json&limit=5000&offset=5000&__after_id=XXX" }

which leads me to believe that default page size is 5000

you can set that limit explicitly if you want to: https://developers.facebook.com/tools/explorer?method=GET&path=me%2Ffriends%26limit%3D1

like image 181
avs099 Avatar answered Oct 12 '22 04:10

avs099


  1. Set the limit yourself using limit=5000 for max limit. I.e so /me/friends?limit=5000

  2. With the JavaScript SDK, two fields are returned, data and paging. Just hit the nextPage URL, and on the next result, there will be no more paging variable/next variable, indicating that you've hit the end.

like image 20
Ali Avatar answered Oct 12 '22 04:10

Ali