Facebook Graph API get all comments - facebook

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.

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.

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.

Related

Get URL (Link) for facebook post using post ID

I am trying to get a post from a company Facebook page.The link is for an application i developed that feeds of information from another applications database that uses the Facebook API.
i want to create a link eg www.facebook.com/{postID} that will take me to the specific post.I have tried numerous articles and all seem to send me to a 404 page. Please help.
Thanks
My Application uses the facebook api that accepts data related to a facebook page content (i.e posts,photo's,statuses etc).part of the api is that it saves the actual post id pertaining to a post for e.g. 302961133120433_576487772434433 into my applications database.As you may see that the post id has 2 parts separated by an underscore.So i needed to make a url based on this post id.
Solution for the link is:(2 parts of it,first being page id and second being actual post id)
Hope this helps.
You have facebook API doc on post here : https://developers.facebook.com/docs/graph-api/reference/v2.8/post
the URL you want is called "permalink_url" as field name, so the API call to get that link is in this format:
URL = 'https://graph.facebook.com/v2.8/' + postId + '?fields=permalink_url&access_token=' + facebookToken
Here is a screenshot for my testing in FB API explorer.
If you want to get a list of posts on IDs on a particular page, it doesnt seem to be documented but this works:
https://graph.facebook.com/teapartypatriots?fields=posts.id&access_token=<TOKEN>
If anyone only needs to redirect to the post URL, just put the post id after https://www.facebook.com/ and it will be automatically taken to the post.
more information from the official docs https://developers.facebook.com/docs/pages/publishing/

Get all pictures and related comments from a Facebook Group page

I need to get all picture and their related comments which has been made to a particular facebook group page. How can I achieve this through facebook api?
Sure, you just need to make a request to graph.facebook.com/GROUP_ID/feed
Example here: https://developers.facebook.com/tools/explorer?method=GET&path=173972555961507%2Ffeed
The Graph API is really easy to figure out. You have the base url (graph.facebook.com) and then you can make requests to any object on facebook (user, page, group, checkin, etc) by just calling graph.facebook.com/OBJECT_ID. It's all on the front page: https://developers.facebook.com/docs/reference/api/

How do I get the most recent comments of Facebook?

So I have a comments box of Facebook on my site ( one on each article I have on my blog ). My client likes a widget with the most recent comments on his site. I found the Activity Feed with the note:
Activity is also displayed when users share content from your site in
Facebook or if they comment on a page on your site in the Comments
box.
I filled in the App ID, but it does not show the comments? Does anyone have an idea how I can get the most recent comments posted in the activity feed?
You should retrieve your comments by your URL, not by app ID.
The comments for every URL can be accessed via the graph API. Simply go to: https://graph.facebook.com/comments/?ids={YOUR_URL}.
For example, the comments on this URL can be accessed via: https://graph.facebook.com/comments/?ids=http://developers.facebook.com/docs/reference/plugins/comments.
Detailed information: How do I access the comments left on my site?
Some more about comment box: Adding new features to Comments Box

Display and post comments on facebook photo from webpage

We would like to use the Facebook Comment plugin (or something similar) on a website. The photos are being pulled in from Facebook to our site (built in PHP). We would like to enable commenting on a particular photo and post the comment back to Facebook. Addtionally, if a comment is made on Facebook, we would also like for the comment to display on the webpage.
From the website, we have only been able to get the comment to apply to the webpage, but not to the photo itself. Thus the comment posts on facebook with a link to the webpage, but does not display the individual photo.
Does anyone know how to successfully post comments on a particular photo from a webpage?
Using the Graph API, just do an HTTP POST to https://graph.facebook.com/PHOTOID/comments?access_token=ValidUserAccessToken with the correct parameters specified (such as message) as well as a user access token with the correct permissions specified.
See the comments connection of photo at https://developers.facebook.com/docs/reference/api/photo/

How to retrieve links posted by third-party Facebook apps?

I am trying to build an app that fetch all the links posted on a Facebook page. I'll use the Kotaku page as an example (https://www.facebook.com/kotaku, Facebook ID is 273824104039).
I have tried to get the links via the graph API (https://graph.facebook.com/273824104039) or via FQL (here is the query I used: SELECT link_id, owner, title, url, owner_comment, summary, created_time FROM link WHERE owner = 273824104039), but both of them only return a subset of the links posted (20 as of writing this post).
(All request were made with an access token from my account that I granted the read_stream permission. I also 'like' the Kotaku page, but according to the documentation the links connection is available to everyone on Facebook.)
If you go on the page, it's pretty obvious that there are more than 20 links, but most of these were posted via the dlvr.it app and those are not showing in the queries above.
So does anyone know it there is a way to get those links as well? If possible, I would like to get all the links posted on that page not just the last 50 or from the last 30 days.
I think the issue is that links posted by apps aren't treated as native Facebook links, they're just posts with attachments, so you're not likely to find anything in links. With that said, try looking at the stream FQL table or the posts parameter of the graph.