how can I get the post ID from the URL?
I need to update the Facebook page post, and I need for that post ID.
Problem is, that I have only the post URL.
What I need to do with Facebook API:
https://graph.facebook.com/v14.0/POST_ID/?message=NEW_TEXT3&access_token=MY_TOKEN
What I have (eaxmple):
https://www.facebook.com/mypage/posts/pfbid12345/
Maybe there is some tool or Facebook API for that?
I try to use "pfbid12345" as post ID, but it’s not working.
2
Answers
Post id may not be available in the url if post has multiple images then URL will refer to media in the post and not the actual post.
However, Facebook follows some format for post id –
<page_id>_<post_id>
, so in your case, you can try<mypage post id>_pfbid12345
and try to update post.If you’ve permission to update the post then you should use fetch page post API to fetch post data and use post id from the same, you must not use id from url for performing action.
As of now in August 2023 it’s still possible to obtain and use the old format URL. Here’s a quick hack that doesn’t require any API calls and can be done via simple copy and paste:
https://news.ycombinator.com/item?id=32118095
(I know link-only answers are discouraged, but I don’t want to take any credit for someone else’s post, so I won’t copy it here.)
The whole thread is a discussion on why this move by Facebook is not a good thing.