Menu

GeoDB City API - Find Cities For Your Criteria | Wirefree Thought

header photo

Getting A Country's Regions

A region is any primary political division, such as a state or province. You can get a country's regions by issuing the following request:

curl --get --include 'https://wft-geo-db.p.mashape.com/v1/geo/countries/{countryCode}/regions?offset=0&limit=500' \
    -H 'X-Mashape-Key: YOUR_API_KEY' \
    -H 'X-Mashape-Host: wft-geo-db.p.mashape.com'

Where:

countryCode The code for a country obtained in a prior call to get the country list.

 

We recommend you set the offset and limit, or they will default to 0 and 10 respectively, giving you back only the first 10 regions. Set a high limit to ensure you get all the regions back in one call. NOTE: Your limit value is capped based on your current subscription plan.

Cache the region list per country to avoid needless hits on the service. We recommend doing this lazily (as needed at runtime) using something like an LRU cache, since in a given session, the user isn't likely to care about all regions for every country.