Skip to main content

Get All Cities

Retrieves a list of all cities.

HTTP Request

GET/api/shop/locations/cities

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`.
orderingstringOrder results by (`name`).
statestringFilter results by state ID.

Example Requests

1import requests
2response = requests.get('http://www.example.com/api/shop/locations/cities', params={
3  'limit': 5,
4  'ordering': 'name',
5  'search': 'Tehran',
6  'state': 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 City objects

City Object Data Structure

FieldTypeDescription
idintegerUnique ID of the city.
namestringName of the city.

Example Response

{
"count": 1119,
"next": "http://127.0.0.1:8000/api/shop/locations/cities?limit=3&offset=3",
"previous": null,
"results": [
{
"id": 527,
"name": "آب بر"
},
{
"id": 261,
"name": "آب پخش"
},
{
"id": 477,
"name": "آبادان"
}
]
}