Menu

GeoDB Cities API

Getting A Region's Places

Below we get the places in California.

GraphQL

curl --request POST \
     --url https://geodb-cities-graphql.p.rapidapi.com/ \
     --header 'content-type: application/json' \
     --header 'x-rapidapi-host: geodb-cities-graphql.p.rapidapi.com' \
     --header 'x-rapidapi-key: YOUR_API_KEY' \
     --data '{"query":"QUERY"}'

Where QUERY:

{
  country(id:"US") {
    region(code:"CA") {
      populatedPlaces(first:10) {
        totalCount
        pageInfo{
          startCursor
          endCursor
          hasNextPage
        }
        edges {
          node {
            id
            name
          }   
        }
      }
    }
  }
}

REST

curl --get --include 'https://wft-geo-db.p.rapidapi.com/v1/geo/countries/US/regions/CA/places?sort=name&offset=0&limit=10' \
    -H 'x-rapidapi-key: YOUR_API_KEY' \
    -H 'x-rapidapi-host: wft-geo-db.p.rapidapi.com'