14

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.

desertnaut
  • 57,590
  • 26
  • 140
  • 166
Marcin Stasiak
  • 203
  • 1
  • 2
  • 7

2 Answers2

14

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.

Cormac Driver
  • 2,511
  • 1
  • 12
  • 10
  • 1
    how can i generate object id when i have url as my only resource.. http://stackoverflow.com/questions/19806802/get-list-of-all-comments-using-url/19807222?noredirect=1#comment29449187_19807222 – HIRA THAKUR Nov 06 '13 at 10:25
  • @cormac driver but live example return a error ..why? – Madhawa Priyashantha Oct 14 '15 at 04:30
  • 3
    After the privacy issue, Facebook updated the comment API. You can only do the followings: 1) Query the comments on your own post by user token 2) Query the comment by you on that post which is quite useless. – David Ng Dec 19 '18 at 11:09
5

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.

Alan
  • 386
  • 1
  • 3
  • 17
ashanrupasinghe
  • 758
  • 1
  • 10
  • 22