List All States
Lists All states with filtering, search and ordering capabilities
HTTP Request
GET/api/locations/states
Authorization
Authorization
- Required: Yes
- Permission: Staff with StatePermission or Admin
- Permission Code: 1622
- Authentication: Token-based (Authorization: Token <your_api_key>)
Query Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
| limit | integer | 10 | Number of results to return per page |
| offset | integer | 0 | Number of results to skip before returning results |
| search | string | — | Search term to lookup results by`id`, `name` and `code` |
| ordering | string | name | Order results by (`id`, `active`, `name`, `code`, `country`) |
| country_id | integer | — | Filter states by country ID |
| country_in | string | — | Filter states by comma-separated list of country IDs |
| active | boolean | — | Filter states by active status (true or false) |
Response Fields
| Field | Type | Description |
|---|---|---|
| count | Integer | Total number of categories |
| next | String | URL for the next page of results |
| previous | String | URL for the previous page of results |
| results | Array[Object] | Array of State objects |
State Object Structure
| Field | Type | Description |
|---|---|---|
| id | integer | Unique state identifier |
| name | string | State name |
| code | string | State code |
| country | integer | Country id |
Sample Response
{
"count": 31,
"next": "http://127.0.0.1:8000/api/locations/states?limit=5&offset=5",
"previous": null,
"results": [
{
"id": 1,
"name": "آذربایجان شرقی",
"code": "EA",
"country": 1
},
{
"id": 2,
"name": "آذربایجان غربی",
"code": "WA",
"country": 1
},
{
"id": 3,
"name": "اردبیل",
"code": "AR",
"country": 1
},
{
"id": 4,
"name": "اصفهان",
"code": "IS",
"country": 1
},
{
"id": 5,
"name": "البرز",
"code": "AL",
"country": 1
}
]
}