Skip to main content

Retrieve State

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

ParameterTypeRequiredDescription
idIntegerYesUnique 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())

Status Codes

CodeDescription
200State retrieved successfully
400Bad request — invalid input
404State not found
500Internal server error

Response Fields

FieldTypeDescription
idIntegerUnique ID of the state
nameStringName of the state
codeStringISO code of the state (e.g., "TE")
countryObjectCountry the state belongs to

Country Object Fields:

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