Retrieves the details of a specific state by its ID.
HTTP Request
GET/api/locations/states/:id
Authorization
Authorization
- Required: Yes
- Permission: Admin or Staff
- Authentication: Token-based (Authorization: Token <your_api_key>)
Path Parameters
| Parameter | Type | Required | Description |
|---|
| id | Integer | Yes | Unique ID of the state |
Example Requests
1import requests
2
3response = requests.get('http://www.example.com/api/locations/states/1',
4 headers={'Authorization': 'Token <your_api_key>'}
5)
6print(response.json())
1curl -X GET "http://www.example.com/api/locations/states/1" \
2-H "Authorization: Token <your_api_key>"
Status Codes
| Code | Description |
|---|
| 200 | State retrieved successfully |
| 400 | Bad request — invalid input |
| 404 | State not found |
| 500 | Internal server error |
Response Fields
| Field | Type | Description |
|---|
| id | Integer | Unique ID of the state |
| name | String | Name of the state |
| code | String | ISO code of the state (e.g., "TE") |
| country | Object | Country the state belongs to |
Country Object Fields:
| 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., "US") |