Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Facebook Graph Api 2.1 get userid from username

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

like image 339
Dhiraj Avatar asked Sep 26 '14 14:09

Dhiraj


People also ask

What user data can I get from Facebook API?

The Graph API is the primary way to get data into and out of the Facebook platform. It's an HTTP-based API that apps can use to programmatically query data, post new stories, manage ads, upload photos, and perform a wide variety of other tasks.

How can I get details of Facebook user?

Finding Contact Information on FacebookEnter a person's name in the search field, and the results identify users with that name or with a closely related name. Scan the results for the person you're seeking. If you are unsuccessful, try some name variations, like William instead of Billy, or Elizabeth for Betsy.

What is Facebook userid?

User ID. Your User ID is a string of numbers that doesn't personally identify you but does connect to your Facebook profile. You have a User ID automatically, whether or not you choose to create a username.


1 Answers

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

like image 180
Syed Abuturab Avatar answered Sep 28 '22 09:09

Syed Abuturab