List All Countries
Retrieves a list of all countries.
HTTP Request
GET/api/shop/locations/countries
Authorization
Authorization
- Required: No
- Permission: Public
- Authentication: None
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 `name`, `code`. |
| ordering | string | — | Order results by (`name`, `code`). |
Example Requests
- 🐍 Python
- 🌐 Curl
1import requests
2response = requests.get('http://www.example.com/api/shop/locations/countries', params={
3 'limit': 5,
4 'ordering': 'name',
5 'search': 'Iran'
6})
7print(response.json())1curl "http://www.example.com/api/shop/locations/countries?limit=5&ordering=name&search=Iran"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 Country objects |
Country Object Data Structure
| Field | Type | Description |
|---|---|---|
| id | integer | Unique ID of the country. |
| name | string | Name of the country. |
| code | string | ISO code of the country (e.g., "IR"). |
Example Response
{
"count": 1,
"next": null,
"previous": null,
"results": [
{
"id": 1,
"name": "ایران",
"code": "IR"
}
]
}