Facebook Fields

Fields

When you make a request to the Graph API for a given object, the API will response with a number of fields for that object. In earlier versions of the Graph API, most - if not all - fields would be returned by default, but as of v2.4 of the Graph API, fewer fields are returned by default.

So in v2.3 a call to get information about the authenticated user (me) would return the following JSON:

{
  "id": "100001100914134",
  "first_name": "Anders",
  "gender": "male",
  "last_name": "Bjerner",
  "link": "http://www.facebook.com/100001100914134",
  "locale": "da_DK",
  "name": "Anders Bjerner",
  "timezone": 2,
  "updated_time": "2014-03-08T12:43:18+0000",
  "verified": true
}

A similar call in v2.4 would return fewer fields by default, only returning:

{
  "name": "Anders Bjerner",
  "id": "100001100914134"
}

What version of the Graph API you are using depends on a few things. You can read about that here. If you are using v2.4, and still want more information than provided by the default fields, you should now explicitly specify which fields that should be returned.

So for direct communication with the API, you should now make a call to similar to /2.4/me?fields=id,name,gender,first_name,last_name rather than /2.3/me or /2.4/meas before. Or when using Skybrud.Social, you can specify the fields like:

// Declare the options for the call to the API
FacebookGetUserOptions options = new FacebookGetUserOptions("me") {
    Fields = "id,name,gender,first_name,last_name"
};

// Make the call to the API
FacebookUserResponse response = service.Users.GetUser(options);

If you don't specify any fields, this call will - as shown by the earlier example - only return the id and name of the user. Also, the id field will always be returned whether it is specified or not.