1

Facebook have updated their graph api to v2.0 recently (april 30, 2014). What is the standard api call to get facebook friends and their profile pictures now? (me/friends does not work as I want all of the friends not friends who use the app)

rmaddy
  • 314,917
  • 42
  • 532
  • 579
user3164248
  • 155
  • 3
  • 8

3 Answers3

3

In v2.0 of the Graph API, /me/friends includes only the user's friends who have also logged into the app.

To get the non-app using friends in the case of tagging and inviting, you can use the new /me/taggable_friends and /me/invitable_friends endpoints.

More details here: Facebook Graph Api v2.0+ - /me/friends returns empty, or only friends who also use my app and here: Get facebook friends with Graph API v.2.0

Community
  • 1
  • 1
Simon Cross
  • 13,315
  • 3
  • 32
  • 26
  • I have successfully used me/taggable_friends to get the friends list. But when I try to get the id of a friend, it gives me an app specific id. So I can not get the profile picture of a friend by using something like /picture. Is there any work around to this? – user3164248 May 05 '14 at 14:36
  • The Taggable Friends API returns all the information you should need about a non-app user. This includes: 1/ a token you can use when tagging or mentioning people in stories published to Facebook 2/ the person's name so you can build a tagging selector UI 3/ a URL to a profile picture for that person – Simon Cross May 15 '14 at 00:48
2

Way late everybody, but this info isn't out there.

Here's how you get the taggable_friends Facebook profile pic (large too!)

 [FBRequestConnection startWithGraphPath:@"/me/taggable_friends?fields=id,name,picture.type(large)"
                             parameters:nil
                             HTTPMethod:@"GET"
                      completionHandler:^(
                                          FBRequestConnection *connection,
                                          id result,
                                          NSError *error
                                          ) {
                          NSArray* friends = [result objectForKey:@"data"];
                          NSLog(@"Found: %i friends", friends.count);
                         for (NSDictionary<FBGraphUser>* friend in friends) {



                             NSDictionary *pictureData = [[friend objectForKey:@"picture"] objectForKey:@"data"];

                             NSString *imageUrl = [pictureData objectForKey:@"url"];

                             NSLog(@"Facebook profile image url %@", imageUrl);



                          }




                      }];

This retrieves all Facebook friends, and parses each friend for the imageURL. You can parse the 'friend' node for the taggable link (only works if you tag a friend from the app) and their username.

John Lanzivision
  • 425
  • 4
  • 12
1
    Next code will provide the taggable_friends with Url pictures at wanted sizes.

Session session = Session.getActiveSession();
    Bundle params = new Bundle();
    params.putString("fields", "picture.width(" + size.x + ").height(" + size.y + ")");
    Request request = new Request(session, "/me/taggable_friends", params, HttpMethod.GET, new Request.Callback() {
        public void onCompleted(Response response) {


        }
    });
    Request.executeBatchAsync(request);
Emil Banca
  • 36
  • 1
  • 2