Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Facebook GraphAPI Reduce amount of data with limit

So I'm struggling to find where this is documented (if at all), but I'm getting the following error message when requesting data from the FB GraphAPI.

"Please reduce the amount of data you're asking for, then retry your request"

The call I'm making is:

/v2.3/user1/posts?fields=object_id&limit=100

If I change it to:

/v2.3/user2/posts?fields=object_id&limit=100

It returns 100 items.

Why would it work for one user, and not the other?

Both requests are authenticated via an access token (not belonging to either user) and I get the same error whether running it from my code, or the Facebook Graph API console of developers.facebook.com

like image 811
justcompile Avatar asked Mar 30 '15 16:03

justcompile


1 Answers

The response from CBroe is correct. Facebook returns this error if it finds that too many internal resources are needed to respond to your request.

Therefore you have to do what the response says: limit it.

This can be done in (afaik) 2 ways:

  1. Use the limit parameter and reduce the amount of responses you expect from the API
  2. Provide a timeframe (using since and / or until) to fetch only data (posts / videos) for a specific timeframe.

We had the same issue as you, but with retrieving videos from a page. Unfortunately using the limit parameter did not work, even when I set it to limit=1. But by using the since / until parameters we finally got results.

Therefore I suggest to implement a timeframe in order to reduce the amount of data, or alternatively, split the amount of requests you make. e.g. if you want all posts from the past 3 months and run into the mentioned error: split your requests in half using since and until. If that still does not work: keep splitting...

=> Divide and conquer ;)

Hope it helps, KR, ebbmo

like image 118
ebb mo Avatar answered Oct 05 '22 20:10

ebb mo