Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Facebook Graph API get all comments

OK, so I've put a Facebook social plugin comments box on my site, in which i specified a Facebook Fanpage, as the comments target.

Now what I want to do is get all comments that are present in the comments box on page my page. I'm using this:

https://graph.facebook.com/comments/?ids=xxx

In place of xxx I placed my fanpage url (displayed comments just from one day even with limit set to 10000) and when this didn't work I tried my page url, which resulted in nothing being displayed.

I'm at a loss here, any help would be appreciated!

like image 342
Marcin Stasiak Avatar asked May 08 '13 11:05

Marcin Stasiak


People also ask

How can I retrieve all comments on Facebook?

How do you look at old comments on Facebook? once you go to Activity Log" then to "Comments" Click on it then scroll down until you see your "Post you comment on" then click on it and it will pull up all the comments on that post, you will then see if there was any new comments on it. ...

How do I get data from Facebook Graph API?

Open the Graph Explorer in a new browser window. This allows you to execute the examples as you read this tutorial. The explorer loads with a default query with the GET method, the lastest version of the Graph API, the /me node and the id and name fields in the Query String Field, and your Facebook App.

Is Facebook Graph API deprecated?

Graph API Version Deprecations: August 3, 2021: Graph API v3. 3 will be deprecated and removed from the platform. November 2, 2021: Graph API v4. 0 will be deprecated and removed from the platform.

Is Facebook Graph API a REST API?

As you suggested, the Graph API, just like the Legacy REST API, is in fact a RESTful API.


2 Answers

The correct syntax to read comments from the Facebook Graph API is as follows:

GET /{object-id}/comments

So your URL would look like this:

https://graph.facebook.com/xxx/comments

Here's a live example that looks at comments on Coca-Cola's cover photo:

http://graph.facebook.com/10152297032458306/comments

You can read more about reading comments via the Graph API here.

like image 168
Cormac Driver Avatar answered Sep 19 '22 22:09

Cormac Driver


check this stackOverflow topic

You need to call it from a secure request https and provide an access_token (19292868552_118464504835613 is Facebook post) :

( (19292868552) is the page or group id and (118464504835613) is the post id)

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 38
ashanrupasinghe Avatar answered Sep 18 '22 22:09

ashanrupasinghe