RESTCountries.NET icon indicating copy to clipboard operation
RESTCountries.NET copied to clipboard

[feature]: add support for country states

Open egbakou opened this issue 1 year ago • 4 comments

To update the dataset, create a new file named "states.json" and save it in the /src/RESTCountries.NET/Services directory. The JSON structure of the file should be as follows:

[
  {
    "countryCode": "country code",
    "states": [
      {
        "name": "State name",
        "cities": [
          "Cities in this state"
        ]
      },
      {
        "name": "Another State name",
        "cities": [
          "Cities in this state"
        ]
      }
    ]
  },
  {
    "countryCode": "another country code",
    "states": [
      {
        "name": "State name",
        "cities": [
          "Cities in this state"
        ]
      },
      {
        "name": "Another State name",
        "cities": [
          "Cities in this state"
        ]
      }
    ]
  }
]

Please ensure that the country alpha 2 code is obtained from the existing data.json file.

To simplify the process, you may automate the task using a script

egbakou avatar Feb 28 '23 19:02 egbakou

Hello, i would like to pick up this feature.

donprecious avatar Oct 03 '23 10:10 donprecious

@donprecious Sure, you can take on this feature :)

egbakou avatar Oct 05 '23 06:10 egbakou

@egbakou i am stating this feature now. i realise including the cities in the state json will make the json file much larger, and processing time will much longer. am think we should have a different data set json for states only. What do you think

donprecious avatar Feb 17 '24 08:02 donprecious

@donprecious Could you please use a separate dataset? Just make sure that the 'countryCode' fields come from the existing dataset.

egbakou avatar Feb 17 '24 08:02 egbakou