Reputation: 2255
I'm trying to get some figures from Facebook telling me which posts have the most likes, comments and shares for a given Facebook page and within a given date range.
I can get these figures if I query the API to get all the individual posts and loop through them in my own code, but I'm often getting an error from the API "600 calls per 600 seconds" rate limit error from them, because I'm making a call for each post. I've tried using FB's batch graph requests but this doesn't reduce the likelyhood of getting that error.
Is there a way to do this so that I don't need to make so many calls?
Upvotes: 1
Views: 6229
Reputation: 31489
You can use FQL (which will be available at least until April 30th 2016) to achieve this in one call:
select post_id, comment_info.comment_count, like_info.like_count, share_info.share_count from stream where source_id={PAGE_ID}
Just replace {PAGE_ID}
with the actual Page ID. You can also run this via a Page Access Token with the read_stream
permission.
If you want just the Page's posts, add the following to the FQL query:
and actor_id={PAGE_ID}
Upvotes: 0
Reputation: 441
Yes, you have to make individual API calls. Batch api requests are counted as normal requests [0]:
For example, a batch of 10 API calls will count as 10 calls and each call within the batch contributes to CPU resource limits in the same manner.
My tips:
[0] - https://developers.facebook.com/docs/graph-api/making-multiple-requests/#limits
[1] - https://stackoverflow.com/a/17234650/1587309
Upvotes: 3