Menu

GeoDB Cities API

Getting Cities Starting with SOME prefix

Below we find cities starting with 'new'.

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:

{
  populatedPlaces(namePrefix="new", types:["CITY"], sort:"name", first:10) {
    totalCount
    pageInfo{
      startCursor
      endCursor
      hasNextPage
    }
    edges {
      node {
        id
        name
      }   
    }
  }
}

REST

curl --get --include 'https://wft-geo-db.p.rapidapi.com/v1/geo/cities?namePrefix=new&types=CITY&sort=name&offset=0&limit=10' \
    -H 'x-rapidapi-key: YOUR_API_KEY' \
    -H 'x-rapidapi-host: wft-geo-db.p.rapidapi.com'