JJDev
JJDev

Reputation: 173

Get URL (Link) for facebook post using post ID

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

Upvotes: 5

Views: 26166

Answers (5)

Andrew Judd
Andrew Judd

Reputation: 13

Currently the urls for a page post are by the following url: https://www.facebook.com/{{page_id or name}}/posts/{post_id}}/

Upvotes: 0

Harsha
Harsha

Reputation: 398

If anyone only needs to redirect to the post URL, just put the post id after https://www.facebook.com/ and it will be automatically taken to the post.

more information from the official docs https://developers.facebook.com/docs/pages/publishing/

Upvotes: 2

Albert
Albert

Reputation: 134

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

Upvotes: 3

JJDev
JJDev

Reputation: 173

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.

Upvotes: 7

josephmisiti
josephmisiti

Reputation: 9974

If you want to get a list of posts on IDs on a particular page, it doesnt seem to be documented but this works:

https://graph.facebook.com/teapartypatriots?fields=posts.id&access_token=<TOKEN>

Upvotes: 0

Related Questions