I am looking for a list of countries/states/cities that can be used with Facebook Graph API when publishing targeted posts.
I found one JSON file available on this page but the file doesn't parse correctly and I also doubt whether it can be used for post targeting since the file is for advertisements.
Also, I am not sure whether the third party data like the one provided by MaxMind can be used directly with Facebook API.
Does anyone have such a list or can atleast point me to a right direction?
The answer is here: https://developers.facebook.com/docs/reference/ads-api/get-autocomplete-data/
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
For countries: search?type=adgeolocation&location_types=['countries']&limit=1000
For regions: search?type=adgeolocation&location_types=['region']&limit=1000&country_code=PT
Hope that helps :)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With