2017-08-09 81 views
0

FB返回hometown這樣的:如何從家鄉ID獲取用戶的國家?

hometown: { 
    id: "106050279435951", 
    name: "Quezon City, Philippines" 
}, 

如何獲得國家使用hometown ID?我看到我可以從name: "Quezon City, Philippines"得到國名,但我很好奇,如果FB Graph API有手段使用該hometown id來獲得一些有關國家的特殊價值。

+0

你檢查出的API文檔?他們會告訴你所有可用的字段。 – luschn

+0

@luschn,如果SO有這個選項,我會低估你的評論 – Green

回答

2

hometown字段指的是一個頁面,該頁面又有一個位置。

106050279435951?fields=location 

結果:

{ 
    "location": { 
    "city": "Quezon City", 
    "country": "Philippines", 
    "latitude": 14.6439, 
    "longitude": 121.037 
    }, 
    "id": "106050279435951" 
} 

您還可以使用範圍擴大到得到這個信息一氣呵成同時要求其他用戶信息,

me?fields=hometown{location},...