Skip to main content

List All States

Retrieves a list of all states.

HTTP Request

GET/api/shop/locations/states

Authorization

Authorization

  • Required: No
  • Permission: Public
  • Authentication: None

Query Parameters

ParameterTypeDefaultDescription
limitinteger10Number of results to return per page.
offsetinteger0Number of results to skip before returning results.
searchstringSearch term to lookup results by`name`, `code`.
orderingstringOrder results by (`name`, `code`, `country`).
countrystringFilter results by country ID.

Example Requests

1import requests
2response = requests.get('http://www.example.com/api/shop/locations/states', params={
3  'limit': 5,
4  'ordering': 'name',
5  'search': 'Tehran',
6  'country': 1,
7})
8print(response.json())

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 Data Structure

FieldTypeDescription
idintegerUnique ID of the state.
namestringName of the state.
codestringISO code of the state (e.g., "IR-07").

Example Response

{
"count": 31,
"next": "http://127.0.0.1:8000/api/shop/locations/states?limit=2&offset=2",
"previous": null,
"results": [
{
"id": 1,
"name": "آذربایجان شرقی",
"code": "EA"
},
{
"id": 2,
"name": "آذربایجان غربی",
"code": "WA"
}
]
}