Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Facebook Graph API: user gender

The old Facebook API provided the user sex/gender as part of the default user data. Apparently the new Graph API does not provide that information, even though the documentation says that it does.

I've heard people say that you need to request special permissions to get it and other pieces of data, but I have not been successful in getting it to work.

Does anyone have an example, using the Facebook Graph API, of how to get the user's gender and/or location (city/state/country/whatever)?

like image 383
Mark Avatar asked Apr 27 '10 16:04

Mark


People also ask

Is Facebook Graph API deprecated?

Applies to all versions. Facebook Analytics will no longer be available after June 30, 2021. Additionally, we are deprecating the App Dashboard Plugin for Marketing API. For more information visit the Business Help Center.

Does Facebook use graph API?

The Graph API is the primary way to get data into and out of the Facebook platform. It's an HTTP-based API that apps can use to programmatically query data, post new stories, manage ads, upload photos, and perform a wide variety of other tasks.

Is Facebook Graph API RESTful?

The Legacy REST API is in the process of being deprecated, while the Graph API is the most current, so if you're unsure of which one to use, your best bet is to go with that one. As you suggested, the Graph API, just like the Legacy REST API, is in fact a RESTful API.

How do I get Facebook Page Insights on graph API?

You can access Page Insights by typing /insights after the name of your page in the URL field. This command will retrieve all of the Insights associated with your Page. Type "/insights" after your company name. Click the Submit button.


2 Answers

You need user_location permission to get the location according to the API reference.

GET https://graph.facebook.com/USER_ID?fields=gender,location

The Graph API tool explorer is a really handy tool for checking the output.

like image 142
jhoanna Avatar answered Sep 28 '22 19:09

jhoanna


Just FYI, location (City and state only, country is still missing) and gender have been added to the Graph API sometimes today.

I was testing an app tonight and noticed there was a couple more fields :)

like image 37
Pier-Luc Gendreau Avatar answered Sep 28 '22 19:09

Pier-Luc Gendreau