Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Retrieve Facebook Post Comments Using Graph API

I tried to get Facebook comments using:

http://graph.facebook.com/[post_id]/comments 

It results only 2 of 15 comments, and without count info.

{     "data": [         {             "id": "[post_id]",             "from": {                 "name": "[name]",                 "id": "[id]"              },              "message": "[message]",              "created_time": "2011-01-23T02:36:23+0000"         },         {              "id": "[id]",              "from": {              "name": "[name]",                  "id": "[id]"              },             "message": "[message]",             "created_time": "2011-01-23T05:16:56+0000"         }     ] } 

Anyone know why only 2 comments?

Also, I want to retrieve comments (default number) or retrieve comments with my limit number, and get its comments count. Any idea? (Please use Graph API).

like image 799
Jeaf Gilbert Avatar asked Jan 25 '11 09:01

Jeaf Gilbert


People also ask

Is Facebook Graph API deprecated?

API Version Deprecations: As part of Facebook's Graph API and Marketing API, please note the upcoming deprecations: August 3, 2021: Graph API v3. 3 will be deprecated and removed from the platform. August 25, 2021 Marketing API v9.


2 Answers

You need to call it from a secure request https and provide an access_token:

https://graph.facebook.com/19292868552_118464504835613/comments?access_token=XXX 

EDIT:
Added the object from the post document. try clicking the comments connection and then remove the access_token and try and see the difference.

like image 87
ifaour Avatar answered Sep 22 '22 10:09

ifaour


In order to get the Like count and the comment count then you need to use a combination of the PostOwnerID and PostID not just the PostID

So for your example it would be:

https://graph.facebook.com/153125724720582_184234384932460/comments

Again, as mentioned in some of the other answers you need to use the https method along with an auth_token

like image 33
codingbadger Avatar answered Sep 22 '22 10:09

codingbadger