add endpoint to get cities within a state.
See original GitHub issueWithin the ./model/countriesStateCity.js Files you’ll find countries, their respective states, and cities within that state.
The goal is to be able to get all the cities within a state. For example, given this data:
{
"id": 1,
"name": "Afghanistan",
"iso3": "AFG",
"iso2": "AF",
"phone_code": "93",
"capital": "Kabul",
"currency": "AFN",
"states": [
{
"id": 3901,
"name": "Badakhshan",
"state_code": "BDS",
"cities": [
{
"id": 52,
"name": "Ashkāsham",
"latitude": "36.68333000",
"longitude": "71.53333000"
},
{
"id": 68,
"name": "Fayzabad",
"latitude": "37.11664000",
"longitude": "70.58002000"
},
{
"id": 78,
"name": "Jurm",
"latitude": "36.86477000",
"longitude": "70.83421000"
},
{
"id": 84,
"name": "Khandūd",
"latitude": "36.95127000",
"longitude": "72.31800000"
},
{
"id": 115,
"name": "Rāghistān",
"latitude": "37.66079000",
"longitude": "70.67346000"
},
{
"id": 131,
"name": "Wākhān",
"latitude": "37.05710000",
"longitude": "73.34928000"
}
]
}
We need to be able to get the cities within “Badakhshan” by sending a POST request to the /state/cities endpoint with this payload:
{
"state": "Badakhshan"
}
Issue Analytics
- State:
- Created 3 years ago
- Comments:10 (8 by maintainers)
Top Results From Across the Web
Countries & Cities API - Population - Postman
Countries and cities population related endpoints. POST. Get single city and its population data ... get a single country with its flag in...
Read more >GeoDB Cities API: Find Cities & Towns
Get global city, region, and country data for use in your apps. GraphQL and REST API supports multiple search filters and languages for...
Read more >Free Rest API for Country, State and City - Universal Tutorial
Hi, I'm testing this using postman at the moment, I get an access token using my email address and key, but when I...
Read more >How I Created My Own Search City and Country APIs
For searching a single city, we have created another endpoint called searchCity . This endpoint will accept the query parameters in the request ......
Read more >Public and up-to-date API for getting country, state, city
You can use Places Autocomplete with Place Details for this where you can get the components of an address. · The link gives...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

@MartinsOnuoha I have created a PR for this issue #40, kindly review the changes.
Hi again @MartinsOnuoha, issue is very clear and I’d highly appreciate working on this.