FQL query to fetch a user's Facebook friend's gender PLUS meeting_sex

1.8k views Asked by At

Not quite as racy as it sounds - I'm using the below code to get a user's male or female friends only and it works fine. However, I also want to check their 'meeting_sex' which is a list of the genders a user's friend is interested in meeting, i.e. male, female or both. (Described here)

The meeting_sex requires the friends_relationship_details permission which I've added to the graph API explorer, but my output looks like this:

"data": [
{
  "name": "ABCDEF", 
  "pic_square": "https://abcdefg.jpg", 
  "sex": "male", 
  "meeting_sex": null, 
  "uid": 123456789
}, 

I.e. the meeting_sex is coming back null. I know the meeting_sex is an array, not just a string, as are the other elements, but why is it coming back null?

I'm new to FQL, and in fact any QL, so once I do get the array to read properly, how do I then make the comparison? i.e so I only return MEN who like WOMEN or MEN who like MEN etc. Here's my current code:

NSString *queryString =  [NSString stringWithFormat:@"SELECT name, pic_square, sex, meeting_sex, uid FROM user WHERE uid in (SELECT uid2 FROM friend WHERE uid1 = me()) AND sex = 'male' ORDER BY name"];
NSMutableDictionary *dictionary = [NSMutableDictionary dictionaryWithObjectsAndKeys: queryString, @"query", nil];

[FBRequest getRequestWithParams:dictionary
                     httpMethod:@"GET" 
                       delegate:self
                     requestURL:@"fql.query"];

Thanks for any help :)

Michael

3

There are 3 answers

2
DMCS On BEST ANSWER

I've tried this on my account and I get nulls for all but one of my friends. They have an empty array for both the meeting_for and meeting_sex

I've found that some have suggested this is no longer being used:

http://forum.developers.facebook.net/viewtopic.php?id=103173

Also, it seems there's a lot of privacy concerns around this:

See https://www.facebook.com/settings/?tab=privacy Click "Apps and Websites" then "How people bring your info to apps they use"

Also From https://developers.facebook.com/docs/reference/rest/users.getInfo/

User Privacy and Visible Data

Important: Depending upon the user's privacy settings (including whether the user has decided to opt out of Platform completely), you may not see certain user data. For any user submitted to this method, the following user fields are visible to an application only if that user has authorized that application and specifically chose to reveal them:

    meeting_for
    meeting_sex
    religion

EDIT

New in the Graph API's user (https://developers.facebook.com/docs/reference/api/user/) object:

interested_in The genders the user is interested in. user_relationship_details or friends_relationship_details. array containing strings.

1
Hyperbole On

The doc says is requires user_relashionship_details or friends_relationship_details. I think it would follow that you need to add user_relashionship_details to get this detail about the user itself, not just their friends.

0
N Jay On

For me i was able to get the data i wanted for "meeting_sex" from the json attribute: "gender": "male", "interested_in": ["female"]

Hope this helps.