Facebook JS SDK’s FB.api(‘/me’) method doesn’t return the fields I expect in Graph API v2.4+

You need to manually specify each field since Graph API v2.4:

Declarative Fields
To try to improve performance on mobile networks, Nodes and Edges in v2.4 requires that you explicitly request the field(s) you need for your GET requests. For example, GET /v2.4/me/feed no longer includes likes and comments by default, but GET /v2.4/me/feed?fields=comments,likes will return the data. For more details see the docs on how to request specific fields.

E.g.

FB.api('/me', 'get', { access_token: token, fields: 'id,name,gender' }, function(response) {
    console.log(response);
});

Leave a Comment