I am looking for a solution which can provide me user id from profile url or fb username
example :http://facebook.com/username
get userid of this url
and also when I try to read friends (I have friend related permission), I am getting blank data array ex:
graph api requ: https://graph.facebook.com/v2.1/me/friends?access_token=xxxxx
response:
{
"data": [
],
"summary": {
"total_count": 455
}
}
Please let me know how can I get friend list and userid using username in Facebook graph api v2.1
graph.facebook.com/username has stopped working. There is an unpleasant workaround. In my limited testing, this works in Chrome.
Wherever you see the facebook user name in a timeline entry, right click and select "inspect element." In the window that opens, scroll up a little and look for the string:
"data-hovercard="/ajax/hovercard/hovercard.php?id=".
The Facebook id of the username you right clicked on follows the = sign.
This only seems to work on names on the timeline.
You can send HTTP request to the facebook profile page from your server-side code
i.e. request to https://facebook.com/some_username
Parse the received response containing HTML source code
and search for a <meta>
tag that has a content
attribute with a value looking like this fb://profile/xxx
where xxx is going to be the profile ID you're looking for.
Hi dhiraj you can get all of your friends username, user id and their profile picture by doing this....https://graph.facebook.com/v2.1/me/taggable_friends?access_token=xxxxx....Hope this helps...and please dont forget to upvote if you identify this as an answer
https://graph.facebook.com/v2.1/me/friends?access_token=xxxxx would return the friends who are using your app i.e., who have authenticated your app...where as https://graph.facebook.com/v2.1/me/taggable_friends?access_token=xxxxx will return all of your friends
I've found if you go to a username's page like:
https://www.facebook.com/username
If you right click on the user's photo, copy the image link you'll get something like :
https://www.facebook.com/photo.php?fbid=12332322&set=a.1afs2&type=3&source=11&referrer_profile_id=100024670088999
The referrer_profile_id
is the user's facebook id. Not much help from an API perspective, but gets you the id.
I have also noticed that the JSON from the /me/home node gives user names and their ids from those people who liked anything. Since these people may also be friends, you might be able to partially figure out user ids for friends by looking at this feed in combination with taggable_friends. I am not sure what the Facebook (v2.3) terms of use says in this regard -- so maybe this isn't allowed?
Duplicate: api to get uid from profile URL on facebook
You can call the graph directly as such: https://graph.facebook.com/username where username is the username you want to lookup.
edit: out of date
来源:https://stackoverflow.com/questions/26062011/facebook-graph-api-2-1-get-userid-from-username