Facebook Graph API get all comments

Marcin Stasiak picture Marcin Stasiak · May 8, 2013 · Viewed 71.3k times · Source

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!

Answer

Cormac Driver picture Cormac Driver · May 8, 2013

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.