The States API fetches a list of all states. You can filter the states based on parameters provided in the payload.
state_name(String, optional) - The name of the state to filter by.
fetch_states(state_name: )To fetch states with a specific name filter:
@client.fetch_states(state_name: "Andhra Pradesh"){
"statesList": [
{
"identifier": 2,
"name": "ANDHRA PRADESH",
"stateISO": "28",
"country": "India"
}
],
"Message": null
}To fetch a list of all states:
@client.fetch_states{
"statesList": [
{
"identifier": 1,
"name": "ANDAMAN AND NICOBAR ISLANDS",
"stateISO": "35",
"country": "India"
},
{
"identifier": 2,
"name": "ANDHRA PRADESH",
"stateISO": "28",
"country": "India"
},
{
"identifier": 3,
"name": "ARUNACHAL PRADESH",
"stateISO": "12",
"country": "India"
},
{
"identifier": 4,
"name": "ASSAM",
"stateISO": "18",
"country": "India"
},
{
"identifier": 5,
"name": "BIHAR",
"stateISO": "10",
"country": "India"
},
{
"identifier": 6,
"name": "CHANDIGARH",
"stateISO": "4",
"country": "India"
},
{
"identifier": 36,
"name": "WEST BENGAL",
"stateISO": "19",
"country": "India"
}
],
"Message": null
}- The
state_namefield can be used to filter the states by their name. - If no parameters are provided, the API will return a list of all available states.