可以分别获取玩家的hometown的国籍和location的国籍。在graph api 工具中只能查找到 hometown字段和location字段,但是不能查到这两个字段下一层的内容。需要自己手动添加
查询代码如下:
https://graph.facebook.com/v3.0/me?fields=hometown{location},location{location}&access_token=YOUR_ACCESS_TOKEN
查询结果如下
{
"hometown": {
"location": {
"city": "Beijing",
"country": "China",
"latitude": 40.9289,
"longitude": 116.390
},
"id": "110730292284790"
},
"location": {
"location": {
"city": "Beijing",
"country": "China",
"latitude": 40.9289,
"longitude": 116.390
},
"id": "110730292284790"
},
"id": "1884097888269515"
}
如果想要查询国家编码可以如下查询
https://graph.facebook.com/v3.0/me?fields=hometown{location{city,country,country_code}},location{location{city,country,country_code}}&access_token=YOUR_ACCESS_TOKEN
查询结果如下
{
"hometown": {
"location": {
"city": "Beijing",
"country": "China",
"country_code": "CN"
},
"id": "110730292284790"
},
"location": {
"location": {
"city": "Beijing",
"country": "China",
"country_code": "CN"
},
"id": "110730292284790"
},
"id": "1884097888269515"
}
国家编码请参照https://en.wikipedia.org/wiki/ISO_3166-1