Skip to main content

List All Countries

Lists All counties with filtering, search and ordering capabilities

HTTP Request

GET/api/locations/countries

Authorization

Authorization

  • Required: Yes
  • Permission: Staff with CountryPermission or Admin
  • Permission Code: 1602
  • Authentication: Token-based (Authorization: Token <your_api_key>)

Query Parameters

ParameterTypeDefaultDescription
limitintegerNumber of results to return per page
offsetintegerNumber of results to skip before returning results
searchstringSearch term to lookup results by `id`, `name`, or `code`
orderingstringOrder results by (`id`, `active`, `name`, `code`)

Example Requests

1import requests
2
3response = requests.get('http://www.example.com/api/locations/countries', 
4  params={
5      'limit': 5,
6      'ordering': 'name',
7      'search': 'Iran'
8  },
9  headers={'Authorization': 'Token <your_api_key>'}
10)
11print(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 Country objects

Country Object Structure

FieldTypeDescription
idIntegerUnique ID of the country
nameStringName of the country
codeStringISO code of the country (e.g., "IR")

Sample Response

{
"count": 1,
"next": null,
"previous": null,
"results": [
{
"id": 1,
"name": "ایران",
"code": "IR"
}
]
}