This question already has an answer here:
Closed 10 years ago.
Possible Duplicate:
How to construct a permalink for objects returned by Facebook's new Graph API?
The Facebook open graph API allows a public search, e.g.
https://graph.facebook.com/search?q=watermelon
The results returned may be statuses, videos, links, photos (and others?).
Each has a post id, e.g.
100000973592583_149321401769498
I wish to construct a URL to the post. For statuses, this seems to work:
http://www.facebook.com/profile.php?id=100000973592583&v=wall&story_fbid=149321401769498
However, for a link (or video or photo), that often works, but sometimes does not. For example, a link with id
45430244790_127287890653212
needed
http://www.facebook.com/posted.php?id=45430244790&share_id=127287890653212&comments=1#s127287890653212
Does someone have experience creating bulletproof links? Are there any docs on it?
Edit: Suppose I know the type as well (video, post, photo, link, ..)
Following FQL:
SELECT permalink
FROM stream
WHERE post_id="45430244790_127287890653212"
would return:
[
{
"permalink": "http://www.facebook.com/posted.php?id=45430244790&share_id=127287890653212&comments=1#s127287890653212"
}
]
Related
This question already has answers here:
Facebook JS SDK's FB.api('/me') method doesn't return the fields I expect in Graph API v2.4+
(4 answers)
Closed 5 years ago.
I used to call facebook page node with feed and posts edges and it return all the fields including comments ect.., but now I don't know what happen, it just return 3 fields (message, created_time and id), I'v tested it with the API explorer, postman and my app (an R package), did Facebook change something ? even in the search API it used to return the category of the page when I search for pages, but it dosent anymore..
https://developers.facebook.com/docs/graph-api/using-graph-api#reading
Check out the section "Choosing Fields", you have to ask for fields you want to get, else you will only get some default ones.
How can one get multiple attachments of a post/status in a group?
For example: A group status that some member wrote and added multiple photos to..
Currently I am using Graph api to get the group stream with group_id/feed and unable to see images attached to a single status - while accessing the feed from Facebook itself I can validate that there are few photos attached to the status.
Using FQL it is possible to get the attachments with the following query:
SELECT attachment FROM stream WHERE post_id = each_post_id
Considering I will have to send this request per post and that FQL will soon be gone I am searching for an alternative.
I was looking for a solution for this as well and actually just found it.
The Facebook Platform changelog says the following:
/v2.1/{post-id} will now return all photos attached to the post: In
previous versions of the API only the first photo was returned with a
post. This removes the need to use FQL to get all a post's photos.
With this knowledge I went to the Graph Api Explorer and found a post that had 2 attachments or more added to it.
After finding the post, and with that the post id, I tried the request Facebook told me to do:
/v2.1/{post_id}
This does NOT give you the desired result. The nice thing about the explorer is that you can search for fields you want to add to your request.
You want to add the attachments (plural) field. NOTE: It might be that the graph api explorer only shows the attachment (singular) field. This is NOT right.
So, to summarize:
Get the post id of the post containing the images.
Create a new request to the graph api that looks something like: /v2.1/{post_id}?fields=attachments
Then read the result to get your desired attachments.
I hope this helps you out as I have been struggling for a while as well.
KR
PS: This is tested with a user and not a group, but it should be basically the same.
PS2: This is just an explanation of how you get attachments of a single post. You can also add the attachments field to the /me/home egde to immediately get all attachments at every post like so:
me/home?fields=message,from,attachments
PS3: The permissions you need are
user_status
read_stream
user_photos
user_videos
Facebook is not very clear on this matter and it is very hard to figure things out like this. So I hope this will help everyone that is searching for this solution.
I answered for the same question here : /v2.1/{post-id} does not deliver photos
It seems it's a Facebook bug. My colleague opened an issue. Here's the link: https://developers.facebook.com/bugs/762280800482269/
You also can find some info here:
https://developers.facebook.com/bugs/790976317600139/
Hope it will help you.
When using Facebook's Open Graph API to get a list of posts, what we get is a post id like XXXX_YYYY which can be converted to facebook.com/XXXX/posts/YYYY
But these links cannot be used with the facebook embed plugin : https://developers.facebook.com/docs/plugins/embedded-posts/
Eg - https://www.facebook.com/permalink.php?story_fbid=229021587215556&id=11239244970&stream_ref=10 works, but https://www.facebook.com/11239244970/posts/229021587215556 doesn't, even when both the URLs load the same post.
How can I fetch the permalink for a post so that it can be used in the embed box.
As answered by 林果皞:
The best way seems to be using facebook's FQL.
This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
How can I move a URL via 301 redirect and retain the page’s Facebook likes and Open Graph information?
I run this blog http://everythingyoumightneed.blogspot.comI am thinking of moving my blogspot blog to a custom domain. I did some research and I found out that if I do so I will lose all my G+ plusones and Facebook likes for my posts. Same thing with Facebook comments. (I have Facebook comment social plugin on each post of my blog)
My question is, whether there is a way, using to avoid this
You cannot change the url associated with the comments. You can, however, modify the code on your new site so that each post points to the comments page for the old url.
on each page on the new domain this will associate the facebook comments with the old domain:
<fb:comments href="THE-OLD-URL"></fb:comments>
So for example for http://newdomain.com/thenewpage.html:
<fb:comments href="http://olddomain.com/theoldpage.html"></fb:comments>
To get this working, first get facebook comments working on your new site using the facebook documentation. Once you have that working, you can put the code above anywhere on the page (I usually put it in the head somewhere). That will tell facebook to use the old url instead.
This will apply to likes, comments, and everything else.
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.