Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Facebook Graph API - get latest comments

I'm trying to parse fb feed to find new comments. First I get posts list by this url http://graph.facebook.com/2.0/page_id/posts. Then I get comments by http://graph.facebook.com/2.0/page_id/post_id/comments for each post. I found that I can use batch_requests and http://graph.facebook.com/2.0/page_id/posts?fields=comments. But I want to ask:

  1. Can I get and parse only new comments? Not for all existing posts. Can I get response sorted by latest comments?
  2. If no, what should I do in next case - Comment for post isn't included in fb/posts because this post created 250 posts before?

P.S. FQL is not good solution because it is deprecated.

like image 636
Евгений Масленков Avatar asked Dec 25 '22 21:12

Евгений Масленков


1 Answers

You can specify an order of reverse_chronological to get the newest comments first. It's not documented but seems to work from v2.0 on.

i.e. Get all post comments w/ newest first

[post_id]/comments?filter=stream&order=reverse_chronological
like image 131
Tama Avatar answered Jan 16 '23 05:01

Tama