How to Find any Facebook ID

Sometimes when using WordPress plugins you sometimes need to provide a facebook ID number. If the facebook URL you are looking at is using a username instead of an ID number it isn’t inherently obvious how to find that profile’s ID number.  You can go into a photo album and it might appear as part of the URL.  OR, this much simpler way takes advantage of Facebook’s open graph API, and the best part is you don’t have to have any clue what open graph means.

Simply go to this URL, substituting in the username in question where it says “yourusername” (facepalm)

https://graph.facebook.com/yourusername

for example:

https://graph.facebook.com/nytimes

will take you to a page with some XML data (don’t be scared) that looks like the following…


{
"id": "5281959998",
"name": "The New York Times",
"picture": "http://profile.ak.fbcdn.net/hprofile-ak-snc4/50415_5281959998_9042_s.jpg",
"link": "http://www.facebook.com/nytimes",
"likes": 1978149,
"category": "Media/news/publishing",
"website": "www.nytimes.com www.twitter.com/nytimes www.youtube.com/nytimes www.foursquare.com/nytimes",
"username": "nytimes",
"founded": "1851",
"mission": "Welcome to The New York Times\u2019s page on Facebook \u2013 a hub for breaking news, features and content you may have missed. We invite you to \"like\" our page and connect with fellow fans.\n\nWe aim to create a space on Facebook.com/NYTimes where readers can exchange intelligent and informed commentary that enhances the quality of our news and information. We value thoughtful comments representing a range of views that make their point politely. A few things we won't tolerate on our Facebook wall: personal attacks, obscenity, vulgarity, profanity (including expletives and letters followed by dashes) and commercial promotion. While most comments will remain posted if they are on-topic and not abusive, moderating decisions are subjective. We will make them as carefully and consistently as we can. \n\nThank you for joining The New York Times community on Facebook. ",
"location": {
"street": "620 8th Avenue",
"city": "New York",
"state": "NY",
"country": "United States",
"zip": "10018",
"latitude": 40.756166337625,
"longitude": -73.990140571728
},
"checkins": 2756,
"talking_about_count": 64029
}

and boom.. you’ve got the ID number and a few other interesting bits of info.

This entry was posted in Tutorial and tagged , . Bookmark the permalink. Trackbacks are closed, but you can post a comment.

Post a Comment

Your email is never published nor shared. Required fields are marked *

*
*

To create code blocks or other preformatted text, indent by four spaces:

    This will be displayed in a monospaced font. The first four 
    spaces will be stripped off, but all other whitespace
    will be preserved.
    
    Markdown is turned off in code blocks:
     [This is not a link](http://example.com)

To create not a block, but an inline code span, use backticks:

Here is some inline `code`.

For more help see http://daringfireball.net/projects/markdown/syntax

You may use markdown syntax in the comments.

This site's anti-spam requires Javascript; enable it and refresh this page to continue.

NoScript Users: Whitelist the domain services.wpspamhammer.com and refresh.