Get URL (Link) for facebook post using post ID

18,831

Solution 1

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.

Solution 2

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. enter image description here

Share:
18,831
JJDev
Author by

JJDev

Updated on July 02, 2022

Comments

  • JJDev
    JJDev almost 2 years

    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