Skip to main content

List all permission codes

Retrieve a list of user groups with optional filtering, searching, and pagination.

HTTP Request​

GET/api/users/permissions/
NOTE: NOT USING THE TRAILING SLASH AT THE END OF THE URL RESULTS TO AN EXTRA REDIRECT WITH 301 STATUS

Authorization​

Authorization

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

Query Parameters​

ParameterTypeDefaultDescription
searchString—Search term to lookup results by `code` and `name`
orderingString—Order results by (`id`, `name`, `code`). Prefix with '-' for descending order

Example Requests​

1import requests
2
3api = requests.Session()
4api.headers.update({'Authorization': 'Token XXXXXXXXXXXXXXXXXXXXXX'})
5response = api.get('http://www.example.com/api/users/permissions/', params={
6  'ordering': 'code'
7})
8print(response.json())

Response Fields​

FieldTypeDescription
idIntegerUnique identifier for the permission
codeIntegerCode of the permission (unique)
nameStringName of the user group (unique)

Example Response​

[
{
"id": 9,
"code": 1001,
"name": "general_settings_read"
},
{
"id": 10,
"code": 1002,
"name": "general_settings_update"
}
]