Get permalink to a post published on user's wall - facebook

Using Facebook dialogs, app users can share stories. I wish to be able to construct a permalink to the published story and offer as link to view the post. What we receive in response is the post_id, which alone doesn't look sufficient.
Would it possible to construct a permalink based alone on the post_id, if not, what other approach are possible?
Thanks a ton for your time.

You can constuct a link to the original posts with the post_id in the URL with this pattern:
http://www.facebook.com/7683938373/posts/7938393003
where the post_id is 7683938373_7938393003. (This is a made up post_id)
Just as a note: You can also access a permalink field from the stream table.
Johnny

Isn't it in the response when you access the post via its ID in the API?
There should be a permalink in there in the actions object which you can direct the user to for them to like/comment on the new post

Related

Extract facebook users IDs who like or comment a post

I wonder if anyone knows or has a tool which allows to extract the list of users IDs who liked or commented a Facebook post (especially a page post).
I've tried many softwares that claim performing this task in vain...
If you have a miracle, please share the love. I'd be glad to have either a software name, a java script, or anything that can do so.
Thank you all.
Would you mind telling what are you going to do with this?
Answer
263907926200 is the sample post id used
Through browser
https://graph.facebook.com/263907926200/comments
https://graph.facebook.com/263907926200/likes
Through API Explorer
->/v2.2/263907926200/comments
->/v2.2/263907926200/likes
FQL Method if you have an old app
Likes
https://graph.facebook.com/fql?q=SELECT user_id FROM like WHERE post_id = "xxxxx_xxxxx"
Comments
https://graph.facebook.com/fql?q=SELECT fromid FROM comment WHERE post_id ="xxxxx_xxxxx"

How to check if a Facebook page post shared by a certain user?

I need a way to learn if a user had shared a post (link, video, photo etc.) which is published by a Facebook page. I have the object_id and link of the post, and user_id of the user considered. Is there a Graph API or FQL (or something else) solution to ask Facebook if the user re-shared the post or not? Or is it possible to get a list people who shared the post? So, I can extract my answer from this list.
Note that I know it is possible to find the answer by crawling the user's wall feed. But it is time consuming and I need a more efficient way.
Thanks in advance.
You can use the following FQL to get the data you're looking for.
SELECT via_id, created_time, owner_comment
FROM link
WHERE owner = me()
You can then compare via_id against the posts author (page ID) to determine if this share came from the page in question.
Unfortunately, there seems to be a bug with the data return where some of the via_ids come back as 0. There is a ticket in with Facebook which, at the time of this post, has been open for three weeks at medium priority. I have no idea if this issue is specific to my app or affects everyone, but that's the query to get what you want.

What is the difference between a Facebook Page "Like" and an external URL "Like"? And will the "user_likes" permission scope give access to both?

I'd like to pull a list of all Facebook "Likes" for a user, whether they are Facebook pages or external URLs.
Example:
If you "Like" the Facebook Platform, I know I can see it via the /me/likes API call.
However, if you like an external URL, I'm not sure how to pull that. Are both supposed to be pulled via the /me/likes call? Or is there another call to handle external likes?
Further, what about newsfeed / stream likes? For example, if I "Like" a photo, video, status or link that I see in my stream, is that accessible via the API? If so, how is this accessed?
Yes, user_likes will give you access to both.
You can access external likes as you wish through the Graph API endpoint /me/likes, as long as they're not articles. Objects with type "article" do not represent real-world objects and as such, we don't provide on a person's profile. We mention this (albeit obscurely) on the Open Graph documentation page: https://developers.facebook.com/docs/opengraph/#types
So if you go to my fake movie object page at
http://fbsb.hoodlu.ms/so_7436857/video2.html
and click like, that will show up when you access your likes on https://graph.facebook.com/me/likes.
Try it using the Graph API explorer:
https://developers.facebook.com/tools/explorer/?method=GET&path=me%2Flikes
If you want the URLs that someone has liked, use this FQL query:
SELECT url FROM url_like WHERE user_id = me()
More information is available at https://developers.facebook.com/docs/reference/fql/url_like/.
If you want to access the likes from a post, photo, video, etc. you'll need to use the like and stream FQL tables. To just pull out the likes (of posts/photos/videos) for the current user:
SELECT user_id, object_id, post_id FROM like WHERE user_id=me()
From there, you would query the stream table for the post to get more information.
like table documentation: https://developers.facebook.com/docs/reference/fql/like/.
stream table documentation: https://developers.facebook.com/docs/reference/fql/stream/
Facebook now has two ways to read likes. If you would like to get the likes of an external URL you try this:
http://graph.facebook.com/me/og.likes/[ID_FACEBOOKOBJECT]
And if you wish get the likes from an internal Facebook page (fan page,profile,photo like) try this:
http://graph.facebook.com/me/likes/[ID_FACEBOOKOBJECT]
Checkout: https://developers.facebook.com/tools/explorer

How to retrieve the comment and LIKE count of a facebook post

I am trying to execute following FQL and the result is always an empty XML
https://api.facebook.com/method/fql.query?query=SELECT post_id, comments.count FROM stream where post_id = 167995709886177
<fql_query_response list="true"/>
This is the post and it has lot of comments and LIKEs
http://www.facebook.com/ryanleslie/posts/167995709886177
Please help
#Anz just go through facebook developer section. all your doubt solve their
You need to use a URL like this:
https://graph.facebook.com/100002725117360_142921995808637?access_token=154407880175|16a3d55d6e4be468d6a131bc.1-100002735407608|IhahmvIUsur7GuZ45rxRj3boXtE
The bolded id (100002725117360_142921995808637) is the ID of the post. The part before the underscore is the user id of the person on whose wall the post appears, and the part after is probably the ID you are using in the example.
This will give you everything you need -- comments, likes, etc. If you want even narrower info, you can do that with URLs like this:
https://graph.facebook.com/100002725117360_142921995808637/likes?access_token=154407880175|16a3d55d6e4be468d6a131bc.1-100002735407608|IhahmvIUsur7GuZ45rxRj3boXtE
Note: this is a test user account, so I'm not exposing anyone's private info here.

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.