question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

add endpoint to get cities within a state.

See original GitHub issue

Within 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:closed
  • Created 3 years ago
  • Comments:10 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
anuragphadniscommented, Oct 3, 2020

@MartinsOnuoha I have created a PR for this issue #40, kindly review the changes.

1reaction
PaulEvans8669commented, Oct 3, 2020

Hi again @MartinsOnuoha, issue is very clear and I’d highly appreciate working on this.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found