Get link to html page for status item

In the Graph API, I have a state update with a given identifier.

REST data endpoint

https://graph.facebook.com/xxxxxxx_yyyyyyyyyyyyyy

where xxxxxxx_yyyyyyyyyyy is replaced by the status update identifier.

GET-ing, which gives me a nice JSON package describing the state.

Now, if I want to provide a link for a person to view the status update?

What is the regular html status update page?

This does not work:

http://www.facebook.com/xxxxxxx_yyyyyyyyyyyyyyyyy


ANSWER

Thanks to Jashwant for the answer .

This is the format you want:

http://www.facebook.com/xxxxxxx/posts/yyyyyyyyyyyyyyyyy

... where xxxxxx is replaced by the identifier of the author, and yyyyyyyy indicates the identifier of the message.

Here is the code I used. In this code, item.id runs xxxxxxxx_yyyyyyyyyyyyyyy .

 var permalink = 'http://www.facebook.com/' + item.id.replace('_', '/posts/'); 
+4
source share
2 answers

If you have story_id (or post_id) and want to skip the overhead of requesting a facebook api, you can split story_id by _ .

The first part will be the identifier of the user, and the second part will be the identifier for the message.

In javascript

 var story_id = "1137725463_413359962029143"; var story_id_split = story_id.split('_'); var user_id = story_id_split[0]; var post_id = story_id_split[1]; var permanent_link = "http://www.facebook.com/" + user_id + "/posts/" + post_id; console.log(permanent_link); 
+3
source

Look at the call received from https://graph.facebook.com/XXX_YYY

 { "id": "XXX_YYY", "from": { "name": "Lix", "id": "XXX" }, "message": "Hello Stack Overflow... how do you do?", "actions": [ { "name": "Comment", "link": "https://www.facebook.com/XXX/posts/YYY" }, { "name": "Like", "link": "https://www.facebook.com/XXX/posts/YYY" } ], "privacy": { "description": "Friends; Except: Restricted", { ... 

Two elements of the actions array contain links to the actual Facebook post.

You can very easily see what data is available to you by playing with the Graph API Explorer . You can navigate around the API and see exactly what you like as a developer, and even check FQL queries ...

+1
source

Source: https://habr.com/ru/post/1414435/


All Articles