开发者

LIMIT, SINCE and UNTIL parameters in page feed

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=开发者_如何学Go100")

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.


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.


I've found the right way to use these parameters. I should pass the limit or any other parameters as 3rd parameter when calling api method:

$feed = $this->fb->api("/PAGE_ID/feed", "GET", array('limit' => 2));


There's nothing wrong with your code. Near as I can tell, the Facebook Graph API is broken; the documented paging parameters have no effect when querying connections.


For me, since and until work when used with the date_format=U parameter, providing values as UNIX timestamps:

me/posts?fields=id,created_time&limit=100&date_format=U&since=1558355000&until=1558356000

Tested in Graph API 2.12 and 3.3


For me since and until are working when:

me/posts?limit=100&since=2017-01-23T13:11:12&until=2019-08-21T01:11:12&fields=id,created_time

or

me/posts?limit=100&since=2017-01-2313:11:12&until=2019-08-2101:11:12&fields=id,created_time
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜