navas
navas

Reputation: 1

Facebook Friend List Graph API

How do I get a list of friends from an user with more information about them (like relationships, birthdate, etc?)

Upvotes: 0

Views: 1137

Answers (3)

Gaurav Taywade
Gaurav Taywade

Reputation: 8347

as per Facebook developer guideline you can access in following ways :

> // Query to fetch the active user's friends, limit to 25.
>     NSString *query =
>     @"SELECT uid, name, pic_square FROM user WHERE uid IN "
>     @"(SELECT uid2 FROM friend WHERE uid1 = me() LIMIT 25)";
>     // Set up the query parameter
>     NSDictionary *queryParam =
>     [NSDictionary dictionaryWithObjectsAndKeys:query, @"q", nil];
>     // Make the API request that uses FQL
>     [FBRequestConnection startWithGraphPath:@"/fql"
>                                  parameters:queryParam
>                                  HTTPMethod:@"GET"
>                           completionHandler:^(FBRequestConnection *connection,
>                                               id result,
>                                               NSError *error) {
>                               if (error) {
>                                   NSLog(@"Error: %@", [error localizedDescription]);
>                               } else {
>                                   NSLog(@"Result: %@", result);
>                               }
>                           }];

Upvotes: 0

bkaid
bkaid

Reputation: 52093

You can run a FQL query like:

SELECT uid, name, birthday, relationship_status, pic_square 
FROM user 
WHERE uid IN (SELECT uid2 FROM friend WHERE uid1 = me())

You can add more user fields as needed. You will need varying extended permissions based on what you are trying to get.

Upvotes: 1

Robin Castlin
Robin Castlin

Reputation: 10996

First of all you need the user to accept your permission to get this data:

https://developers.facebook.com/docs/reference/api/permissions/

Upvotes: 0

Related Questions