This API lists the states of a specific country.
| Property | Value |
|---|---|
| URL | {{APP_URL}}/api/v1/countries/{country_id}/states |
| HTTP Method | GET |
| Content Type | application/json |
| Authentication | APIKEY header |
| Parameter Name | Parameter Type | Required | Description |
|---|---|---|---|
country_id |
Integer | Required | Country ID |
Below is an example HTTP raw request for the API request.
GET {{APP_URL}}/api/v1/countries/1/states
Content-Type: application/json
APIKEY: {{APIKEY}}
On a successful request, the API will return a response like the following:
{
"status": true,
"message": null,
"data": [
{
"id": 1,
"name": "Badakhshan",
"stateCode": "BDS"
},
{
"id": 2,
"name": "Badghis",
"stateCode": "BDG"
},
{
"id": 3,
"name": "Baghlan",
"stateCode": "BGL"
},
{
"id": 4,
"name": "Balkh",
"stateCode": "BAL"
},
{
"id": 5,
"name": "Bamyan",
"stateCode": "BAM"
}
]
}
If the API request fails, the API will return an error response like the following:
{
"status": false,
"errors": [
{
"message": "Country not found"
}
]
}