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

header photo


There are currently no blog comments.

Sort Cities, Get The User's Current City, And More

All API operations returning city collection results now provide an optional sort parameter taking multiple sort directives. What this means is you can now do something like get all cities sorted by country code, then by name. Or get all cities near a location, sorted by largest cities first.

And speaking of location, the following new operation is now available:

curl --get --include '{locationId}/nearbyCities?radius={radius}&distanceUnit={KM | MI)' \
    -H 'X-Mashape-Key: YOUR_API_KEY' \
    -H 'X-Mashape-Host:'

Among other things, this now allows you an easy way to get the user's current city.

Bug Fixes

  • The HATEOAS links for paged results have been corrected to include any specific query parameters from the original request.
  • The parameters related to location filtering have been renamed to be shorter. If you've been relying on these parameters, please make a note to update your code for the changed names. (Note: Any future such changes will be scoped by a new version of the API, insulating code relying on the previous version.) These changes are:
    • nearLocation → location
    • nearLocationRadius → radius
    • nearLocationRadiusUnit → distanceUnit

Let Freedom Ring!

Over the holidays, we went through a spiritual transformation and got in touch with our giving side. Drum roll...GeoDB now provides a FREE instance with the following generous usage limits:

Up to 5 requests/sec per unique IP.

For more details, go here to compare with the Pro levels.

Santa's Got More: Distance Between Cities, Location Enhancements

You can now find the distance between any two cities.

curl --get --include '{fromCityId}?toCityId={toCityId}&distanceUnit={KM | MI)' \
    -H 'X-Mashape-Key: YOUR_API_KEY' \
    -H 'X-Mashape-Host:'

In addition...

Find-Cities API Enhancements

  • When finding cities using location criteria, GeoDB will now include each city's distance from the requested location, sorting results by distance.
  • All city results now include latitude/longitude, saving you a trip to the Get-City-Details API.

Merry Christmas & Happy Hanukkah: Time-Zones Are Here!

All cities now include time-zone data. The following functionality is now available:

Get Available Time-Zones

Gets all available time-zones in the system. You should use these time-zone IDs as input to the other methods below, as GeoDB has its own way of encoding the '/' separator.

curl --get --include '' \
    -H 'X-Mashape-Key: YOUR_API_KEY' \
    -H 'X-Mashape-Host:'

Find Cities by Time-Zones

Finds all cities in the given comma-delimited set of time-zones.

curl --get --include '{commaDelimitedZoneIds}&offset=0&limit=10' \
    -H 'X-Mashape-Key: YOUR_API_KEY' \
    -H 'X-Mashape-Host:'

Get City Date-Time

Returns the given city's date-time in ISO-8601 format, taking into account daylight savings.

curl --get --include '{cityId}/dateTime' \
    -H 'X-Mashape-Key: YOUR_API_KEY' \
    -H 'X-Mashape-Host:'

Get City Time

Returns the given city's time in ISO-8601 format, taking into account daylight savings.

curl --get --include '{cityId}/time' \
    -H 'X-Mashape-Key: YOUR_API_KEY' \
    -H 'X-Mashape-Host:'

Get Time-Zone Date-Time

Returns the given time-zone's date-time in ISO-8601 format, taking into account daylight savings.

curl --get --include '{zoneId}/dateTime' \
    -H 'X-Mashape-Key: YOUR_API_KEY' \
    -H 'X-Mashape-Host:'

Get Time-Zone Time

Returns the given time-zone's time in ISO-8601 format, taking into account daylight savings.

curl --get --include '{zoneId}/time' \
    -H 'X-Mashape-Key: YOUR_API_KEY' \
    -H 'X-Mashape-Host:'

Now get nearby cities in a single call!

You can now easily find cities near a given city in a single call. Previously, you had to first get a city's details to obtain its latitude/longitude coordinates, then make a separate call to find all cities in that location. Now you can just do:

curl --get --include '{cityId}/nearbyCities?nearLocationRadius={nearLocationRadius}&nearLocationRadiusUnit={nearLocationRadiusUnit}&minPopulation={minPopulation}&offset=0&limit=500' \
    -H 'X-Mashape-Key: YOUR_API_KEY' \
    -H 'X-Mashape-Host:'

Go here for more details.

View older posts »