Reputation: 8467
I need to get age range for the user himself (not friend)
As per https://developers.facebook.com/docs/graph-api/reference/v2.1/user
user_range
is part of the /me
node. But, I decoded the response object and there is no age_range
over there.
I am using facebook javascript sdk. Is age_range available? how? is it still accessible through the 'signed _request
'?
Upvotes: 0
Views: 2588
Reputation: 430
You'll have to explicitly tell the API that you need age_range, as part of the public profile (no special permissions required). The user's age range may be 13-17, 18-20 or 21+.
/* make the API call v.2.3 */
FB.api(
"/me?fields=age_range",
function (response) {
if (response && !response.error) {
/* handle the result */
}
}
);
read documentation https://developers.facebook.com/docs/graph-api/reference/age-range/
Upvotes: 0
Reputation: 8467
I was accessing the /me
node via the graph API.
I found out that the age_range is not returned with the root object but to get age_range
, I need to issue the following API call
me?fields=age_range
This gives me a JSON obejct age_range that has min and max values.
Upvotes: 1