Facebook Graph API:用户性别

发布于 2024-08-30 07:08:27 字数 196 浏览 3 评论 0原文

旧的 Facebook API 提供用户性别作为默认用户数据的一部分。显然,新的 Graph API 没有提供该信息,尽管文档说它提供了。

我听人们说你需要请求特殊权限才能获取它和其他数据,但我还没有成功地让它发挥作用。

有没有人有一个使用 Facebook Graph API 的示例,说明如何获取用户的性别和/或位置(城市/州/国家/其他)?

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)?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

小糖芽 2024-09-06 07:08:27

您需要 user_location 权限才能根据 API 参考获取位置

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

Graph API 工具浏览器 是一个非常方便的检查输出的工具。

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.

花间憩 2024-09-06 07:08:27

仅供参考,今天有时已将位置(仅限城市和州,国家/地区仍然缺失)和性别添加到 Graph API 中。

今晚我正在测试一个应用程序,注意到还有几个字段:)

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 :)

青巷忧颜 2024-09-06 07:08:27

我看到这个问题有一个开放的赏金,尽管这个问题真的很老了。

即使没有任何 access_token,您也可以使用 Open Graph 获取任何用户的性别。

GET https://graph.facebook.com/userid
json_decode the data
gender will be in the `gender` element of the returned array.

编辑:/me 中不再存在用户位置、家乡、国家/地区等。 Facebook 似乎删除了这些内容,即使它们是公开的。

希望这会有所帮助

I see this has an open bounty even though the question is really really old.

You can get the gender of any user using Open Graph even without any access_token.

GET https://graph.facebook.com/userid
json_decode the data
gender will be in the `gender` element of the returned array.

EDIT : user location, hometown, country etc are no more there in the /me. seems like Fb removed those, even if they are public.

Hope this helps

不知所踪 2024-09-06 07:08:27

据我所知,诸如 user_location 之类的某些权限目前根本不起作用。我可以获得电子邮件权限和其他一些权限,但对于大多数用户来说,不。是的,他们将性别作为默认数据的一部分是错误的,而且似乎也没有获得许可。因此,请使用旧的 api,直到新的 api 中的问题得到解决。

As far as I can tell some permissions like user_location simply aren't working at the moment. I can get email permissions and some others but for most of the user_... ones, nope. Yes they are wrong about gender as part of default data and there appears to be no permission for it either. So use the old api until the kinks in the new one get worked out.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文