freedev
freedev

Reputation: 30027

How to get page_id from facebook url

my question is how get facebook page_id starting from a simple fb url. For example:

Actually if the url match the string "facebook.com/pages/" I call:

else I call:

This approach seems to work well, but it is really empirical and looking at documentation I don't see any suggestion.
What do you think about?

Upvotes: 12

Views: 23763

Answers (3)

user13681447
user13681447

Reputation: 101

Simple Instructions:

  1. Go to the desired Facebook page
  2. Ctrl + U to view Page Source
  3. Ctrl + F to open a search dialog box
  4. Using the search dialog box, search "page_id=" in the code
  5. The 'page_id' should follow the "=" symbol

TEST:

Search for the desired page using the 'page_id' in place of the page name:

www.facebook.com/[insert 'page_id' here]

Upvotes: 10

versionz
versionz

Reputation: 29

For my OG meta <meta property="fb:app_id" content="010101010101010" />

I got my page app id by going here:

https://developers.facebook.com/docs/plugins/page-plugin

get code > appId

Line 6: js.src = "//connect.facebook.net/en_US/sdk.js#xfbml=1&version=v2.9&appId= 010101010101010";

The sharing debugger has now stopped complaining https://developers.facebook.com/tools/debug/

Upvotes: 0

dawogfather
dawogfather

Reputation: 654

I'm not quite sure what you're asking but I think what you're talking about is trying to get the id of a page that you only know by its "vanity url" or "nickname".

Basically you can do a facebook graph api request to the "vanity url" and then grab the id from the provided request.

For example... if you open the Facebook graph API explorer https://developers.facebook.com/tools/explorer?method=GET&path=coca.cola.

or make a request to http://graph.facebook.com/coca.cola

you can see in the response you get "id": "40796308305" which is the page ID you are talking about.

Navigating to http://www.facebook.com/40796308305 should prove that.

Hope that helps.

Upvotes: 7

Related Questions