Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Facebook's 5000 Post API Limit

I have a question about the way Facebook limits your api calls.

Toward the bottom of this article: http://developers.facebook.com/blog/post/478/ facebook says:

In addition to the limits mentioned in the documentation for each of the tables and connections listed above, it is helpful to know that the maximum number of results we will fetch before running the visibility checks is 5,000.

I am wondering how one would page through public data like this. For example, take Shakira: she gets many, many likes on each photo she uploads, this api call:

https://graph.facebook.com/5027904559_10150854808869560/likes?format=json&limit=1000&offset=0&__after_id=100002349968919

ends up stopping at 5000 likes.

https://graph.facebook.com/5027904559_10150854808869560/likes?format=json&limit=1000&offset=5000&__after_id=100000881924617

One interesting point is, this data is all public, I do not have to be logged into Facebook to see it. I know there are privacy policies on how you use the data, that is not my question. If the data is public, which this data is, why can't we get it all, and if we can, how?

The main questions are:

  1. Can you get more than 5000 results for a specific API call, as in the one above?

  2. Is it the most recent 5000 likes? So if you started collecting data on this post right away and then went back every 10 minutes or so to look for new likes, would you be able to get all the data with this method of preventing the 5000 limit?

  3. Is it a limit on API calls, or on just the number of results they send one user, or on the amount of results they send back for a certain post, etc.?

  4. Does this apply to posts, tagged and the comments and like paging?

I know this question is a bit open-ended, but I have looked all over the place for an answer and it is not well documented. Any help would be great, and I think a lot of people may refer to this information in the future.

UPDATE:

When running this API call:

https://graph.facebook.com/5027904559_10150854808869560/likes?format=json&limit=1000&offset=4964&__after_id=100000881924617

You get back one result, and thus hit the limit (well at least close to it). Someone suggested using FQL and that might return more. But I tried doing the same thing in PHP with FQL and got back only 1 record.

$select = urlencode("SELECT user_id, object_id, post_id FROM like WHERE post_id='5027904559_10150854808869560' LIMIT 1000 OFFSET 4964");
        $fql_query_url = 'https://graph.facebook.com/fql?q=' . $select;
        $fql_query_result = file_get_contents($fql_query_url);
        $fql_query_obj = json_decode($fql_query_result, true);

So, so far, the only answer is 'no', you are always limited to 5000 results. And I do not think/know if a specific access_token with some specific permission helps.

One more update, when I go to Shakira's page and click on 'x amount of people like this' and start scrolling down through the list, I also hit a limit. So not only is Facebook limiting the API and FQL returns, they are limiting their own pages.

I would be interested to see if anyone knows why? They only have 5k in cache at a time, and they would not be able to handle the scale if people were hitting the database with so many requests? Just a guess.

like image 455
chantheman Avatar asked May 02 '12 21:05

chantheman


1 Answers

There is no way to get more than the last 5000 objects, sadly.

Unless, as you said, you maintained it from a time when there were LESS than 5000, and stored them. :)

It may or may not be intentional (maybe they are trying to let old news die and not be found easily), or, it may coincide with the amount of friends you're allowed on Facebook, 5000.

like image 112
DanRedux Avatar answered Sep 20 '22 20:09

DanRedux