using the facebook API to receive the page ID by a post ID

867 views Asked by At

I have an issue that I only have the post IDs of posts in my data repository. Since the Graph API I have to prefix the page ID before the post ID. Since I have no information what page posted this post I have a problem here.

I have my post IDs available but now need to know which post is allowed to get which post ID as prefix.

Therefore I'm looking for a way to give a post ID and receive the page ID.

Any API call that might give me that information actively or just a side-information?

2

There are 2 answers

2
xetra11 On

I found this here:

https://graph.facebook.com/v2.8/139946919369293_811518108920728?access_token={token}&fields=from

?fields=from

does return this:

{
  "from": {
    "name": "Henkel Careers",
    "id": "301655703240307"
  },
  "id": "301655703240307_811518108920728"
}

Unfortunetly that does not make any sense especially in my case. Since the Graph API does ONLY allow {page_id}_{post_id} combinations you need to actually provide the page_id in order to receive the page id by the mentioned above request.

I hope somebody has another solution!

0
Chockalingam Subramanian On

You can try using a users access_token to get a set of page_access_tokens - then you can try mapping to the data repository and give them the option of posting to these pages using these access tokens based on the return JSON object data.