从 Facebook Graph API 获取当前城市的国家/地区
FB graph api 似乎总是为“当前城市”和“家乡”的美国字段返回“城市,州”,但似乎总是为“城市,国家”返回“城市,国家”美国以外的任何东西。
这是一个可靠的假设吗?除了美国还有其他国家会回归“城市、州”吗? FB 文档(https://developers.facebook.com/docs/reference/api/user/)没有解释这一点,我有点猜测我的方法。
FB graph api seems to always return "city, state" for USA fields of "current city" and "hometown", but seems to always return "city, country" for anything outside of the USA.
Is this a reliable assumption? Are there any other countries besides US that would return "city, state"? The FB Docs (https://developers.facebook.com/docs/reference/api/user/) don't explain this, and i'm kinda guessing my way around this.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我将使用 FQL 并查询
user
current_location
字段的表,它将返回更全面且结构良好的响应:您可以尝试在 Facebook Graph API 资源管理器中使用新的
fql
端点。它将返回类似以下内容的内容:请注意,
city
、state
和country
字段以及不一致名称字段。
I would use the FQL and query the
user
table for thecurrent_location
field which would return a more comprehensive and well structured response:You can try is in the Facebook Graph API explorer using the new
fql
end-point. Which would return something like:Notice the
city
,state
andcountry
fields are there along with the inconsistentname
field.