Question

I'm using Facebook SDK ( http://facebooksdk.net ) and want to get friend list with the following information: 1. ID 2. Name 3. Photo 4. link 5. Email 6. etc...

I have read Facebook's documentation and different posts of forum (including stackoverflow), but I'm confused. After it I'm not sure, is it possible to get this information by API request or not. First at all, this request returns only ID and name data:

        var client = new FacebookClient("XXX");
        dynamic friends = client.Get("/me/friends");

Next step - try to modify this request to specify returned fields:

        var client = new FacebookClient("XXX");
        dynamic friends = client.Get("/me/friends?fields=about,bio,age_range,first_name,gender,address,email,location,link,languages,username,last_name,timezone,updated_time");

it returns only some fields:

  "first_name": "XXX", 
  "gender": "male", 
  "link": "https://www.facebook.com/XXX", 
  "username": "XXX", 
  "last_name": "XXX", 
  "updated_time": "2013-09-07T12:18:34+0000", 
  "id": "XXX"

is it possible to return more fields? As I understood, it depends on permissions. I try to set these permissions. I go to Applications -> MyApp -> Permissions, and see, that field "User & Friend Permissions" is empty. I try to set some permissions, i.e.

user_about_me,friends_about_me

and after click "Save" button I see the message:

Changes saved. Note that your changes may take several minutes to propagate to all servers.

but field "User & Friend Permissions" is empty again. First question : why and how can I see all set permissions?

secondly - I don't see any changes in my request via FacebookClient (but field "About" is added to request). Why?

Thanks

Was it helpful?

Solution

The fields that you can get without any extra permissions:

  1. first_name
  2. gender
  3. link
  4. username
  5. last_name
  6. updated_time
  7. id

With permissions-

friends_about_me - about, bio
friends_location - location
friends_likes - languages

Invalid fields (I don't know from where you saw these)-

  1. age_range
  2. address
  3. email
  4. timezone

Another thing that you are not getting all the fields is because the permissions are not being asked by the user (and hence not granted any to your app).

This is because, you have to add the permissions in your code, while login-in the user- not just adding permissions in the App Settings.

For eg, if you are using javascript sdk, it is done using the scope parameter. Reference


You can always test your call here: Graph API Explorer

OTHER TIPS

To answer your first question, you can see the answer here, use the Facebook graph api and search /{user id}/permissions.

Some clerification for the rest. You can't get friends email address as answered here. In order to get the friends profile picture you need to add the field picture (you can specify the size like this picture.width().height().

I reccomend you try to use Facebooks Graph Api Explorer to play with the permissions and the info you request.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top