I've noticed some difference in Facebook profiles :
Some of them have the following string format at browser nav bar :
http://facebook.com/john.smith
and the others look like this : http://www.facebook.com/profile.php?id=100455*
Can someone explain why there is a difference ?
And more important is how can I convert those john.smith like names to id numbers ?
These are alias urls that Facebook offers its users (and pages) - its basically a vanity thing, both the id and the alias url will work the same way.
You can translate the alias (or username) by doing a lookup for that user using the Facebook Graph API. Simply make a GET request to https://graph.facebook.com/John
for example - this will serve the following response:
{
"id": "779695190",
"name": "John Chan",
"first_name": "John",
"last_name": "Chan",
"link": "http://www.facebook.com/John",
"username": "John",
"gender": "male",
"locale": "en_US",
"updated_time": "2011-12-27T05:01:06+0000",
"type": "user"
}
response.id
is what your interested in.
Test it out: http://developers.facebook.com/tools/explorer?method=GET&path=john
You're not really want to converting the ids to names but getting id by username
which is possible by issuing request to Graph API:
GET https:/graph.facebook.com/john.smith?fields=id
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With