Skip to main content

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​

ParameterTypeDefaultDescription
limitinteger10Number of results to return per page
offsetinteger0Number of results to skip before returning results
searchstring—Search term to lookup results by`id`, `name` and `code`
orderingstringnameOrder results by (`id`, `active`, `name`, `code`, `country`)
country_idinteger—Filter states by country ID
country_instring—Filter states by comma-separated list of country IDs
activeboolean—Filter states by active status (true or false)

Response Fields​

FieldTypeDescription
countIntegerTotal number of categories
nextStringURL for the next page of results
previousStringURL for the previous page of results
resultsArray[Object]Array of State objects

State Object Structure​

FieldTypeDescription
idintegerUnique state identifier
namestringState name
codestringState code
countryintegerCountry 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
}
]
}