LIMIT, SINCE and UNTIL parameters in page feed

haynar picture haynar · Sep 6, 2011 · Viewed 32.6k times · Source

I'm trying to get the news feed of page (I'm admin of that page) using the limit, since and until parameters, but it doesn't work, it doesn't work even in graph api explorer tool. I'm requesting the following:

$fb->api("/PAGE_ID/feed?limit=100")

but it always returns me the last 25 posts, the since and until parameters don't work also. What's the wrong in my code?

Thanks in advance.

Answer

Scott Graph picture Scott Graph · Sep 24, 2012

For those not using the PHP SDK and are hitting the relevant Graph API URL directly, simply append

&limit=SOMEPOSITIVEINTEGER

to the end of the URL like so:

https://graph.facebook.com/PAGEGRAPHOBJECTID/posts/&since=2011-07-01&until=2012-08-08&access_token=ACCESSTOKEN&limit=100

Unfortunately, depending on which Graph resource you're hitting, you may get an error if the limit is over a certain threshold and there's no rhyme or reason to this that I can ascertain. For example, getting comments or likes for a post, I've used a limit of 4900 without getting an error. When getting posts from the page feed, that same number gave me an error and now I use a limit of 100 then paginate until my cron sees posts outside the date range.

I imagine though that FB would like for us to use the default limit of 25 and paginate so I'm personally refactoring to accomodate this.