如何从Facebook API获取特定国家/地区的所有城市?

时间:2019-05-15 17:43:54

标签: facebook-graph-api

Facebook对城市有自己的定义,因此我如何获得它所考虑的所有城市的清单。按州或国家。

1 个答案:

答案 0 :(得分:0)

请参阅第二个答案:List of countries and cities to be used in Facebook Graph API for targeting

To check what countries are available you could just get a response from this endpoint:

URL: https://graph.facebook.com/API_VERSION/search?type=adgeolocation&location_types=['country']

HTTP_METHOD: GET

You also have to set your access token in the URL.

To just see the fields key and name and a larger quantity of countries without being paginated this would be the complete URL:

https://graph.facebook.com/API_VERSION/search?type=adgeolocation&location_types=['country']&fields=key,name&limit=1000

非常感谢您!