Get all pictures and related comments from a Facebook Group page - facebook

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/

Related

Facebook Graph API get all comments

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.

Comments social plugin for Action post

I have an app app1 which defines a custom Facebook action act1.
When a user performs this action to an entity (ntt1) in my app, I post to API /me/app1:act1 with URL to ntt1 as its param, so that a post is generated on user's wall saying User act1'ed ntt1 where ntt1 is a link to ntt1's view page (with open graph meta data on its header).
Users can comment or like on this wall post regularly.
Now I want to show users' comments on ntt1's web page as well to share the comments and likes between the Facebook wall and ntt1's view page.
I tried using the Comments social plug-in, but don't know what to put in the data-href to point to the action_instance_id of the wall post.
I know I can simulate a comments box on my page using the graph API (and I've already done so), but this is not making a good ux, because the users need to authorize to my application to view this page (so that the java script API can fetch the comments from the Facebook).
Have you tried just pointing the data-href attribute to
https://www.facebook.com/{user_name_or_id}/activity/{action-instance-id}
…? The docs for using actions say this is the URL you can use to “preview” the news feed story that this published action will generate (or rather has already generated, because without publishing the action first, you would not have an action-instance-id).
If you click on the “x minutes/hours/… ago” link for the feed story for one of your published actions, it should take you to a link that’s build using the same scheme.

Facebook API restserver error with likes and comments

I'm having this strange problem: I have a link for a picture and i want to display it on my wall. Now i want to know how many times it was liked, shared and commented on. Let's say my picture url is http://mywebsite.com/mypicture.jpg?468
Now, I share this picture on my wall, I get likes, shares and comments.
If i'm using the http://api.facebook.com/restserver.php?method=links.getStats&urls=... i can see the shares, but not the likes or comments number.
Why is that? Do you think it's because of the ?468 after the .jpg? If so, why is that happing and only the shares are counted, and not the likes or comments?
For starters, you should be using the Graph API. The restserver.php file you are pointing at is deprecated at this point.
You will want to use the send (or like) plugin from Facebook. The REST API is deprecated (no longer supported and will be pulled completely from Facebook at anytime).
Then your url being shared will get a id from facebook and the stats tracked. Here's some examples: http://graph.facebook.com/?ids=CocaCola or http://graph.facebook.com/?ids=http://www.coca-cola.com

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.

What is the API for Facebook 'profile stream' aka wall posts?

Is there an API call, and if so, which call to get the 'posts to my wall from myself and others' on Facebook? It seems like it could be filtered out of the Facebook stream API, but it's not clear how that works to me.
This link seems to imply it's possible:
http://developers.facebook.com/news.php?blog=1&story=225
You want to do an FQL query like this:
SELECT actor_id, message FROM stream WHERE source_id = <user id> limit 50
You will probably want to select a few more fields, you can see what is available here: http://wiki.developers.facebook.com/index.php/Stream_%28FQL%29
Here it is.
Profile feed (Wall): https://graph.facebook.com/me/feed?access_token=...
https://developers.facebook.com/blog/post/465
You can publish stories to people who like your Open Graph Page the same way you write a Facebook post from your own wall. The stories appear in the News Feeds of people who have clicked the Like button on the Open Graph Page.
You can also publish using our API. If you associate your Open Graph Page with a Facebook app using the fb:app_id meta tag, you can publish updates to the users who have liked your pages via the Graph API.
First you need to get an access token for your app.
Check out the blog post, it covers everything you need.