Menu

GeoDB Cities API

Getting Cities Starting with a given prefix

You can find all cities whose name starts with a specific prefix by issuing the following request:

curl --get --include 'https://wft-geo-db.p.mashape.com/v1/geo/cities?namePrefix={namePrefix}&sort={sort}&offset=0&limit=10' \
    -H 'X-Mashape-Key: YOUR_API_KEY' \
    -H 'X-Mashape-Host: wft-geo-db.p.mashape.com'

Where:

namePrefixThe first few letters of the city's name (including any spaces in it). Not case-sensitive.
sortOptionally, how to sort the results. Format: ±SORT_FIELD,±SORT_FIELD where SORT_FIELD = countryCode | elevation | name | population

 

You could use this for something like an autocomplete/autosuggest widget.