# Roles
# Paginate Roles
GET
/roles# Example Request
curl --location --request GET 'https://yourwebsite.com/api/roles' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer {api_key}' \
--header 'Authorization: Bearer {api_key}'# Example Response
{
"data": [
{
"name": "my_role",
"display_name": "My Role",
"description": "Default system role.",
"id": 1,
"removable": true,
"users_count": 1,
"created_at": "2017-04-20 16:47:59",
"updated_at": "2017-04-27 10:47:59"
},
// ...
],
// ...
}# Available includes
If provided, the available includes will be part of the response for each ticket object.
permissionsA list of permissions available for a each role.
users_countA number of users with that role.
# Sortable Fields
name, created_at (default)
# Partial filters
name
# Create Role
POST
/roles# Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| name | String | Yes | Role name for using it within the code. |
| display_name | String | Yes | Role display name. |
| description | String | No | A short role description. |
# Example Request
curl --location --request POST 'https://yourwebsite.com/api/roles' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer {api_key}' \
--header 'Authorization: Bearer {api_key}' \
--data-raw '{
"name": "my_role",
"display_name": "My Role",
"description": "Default system role."
}'# Example Response
{
"data": {
"name": "my_role",
"display_name": "My Role",
"description": "Default system role.",
"id": 1,
"removable": true,
"users_count": 1,
"created_at": "2017-04-20 16:47:59",
"updated_at": "2017-04-27 10:47:59"
}
}# Get Role
GET
/roles/{id}# Example Request
curl --location --request GET 'https://yourwebsite.com/api/roles/{id}' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer {api_key}' \
--header 'Authorization: Bearer {api_key}'# Example Response
{
"data": {
"name": "my_role",
"display_name": "My Role",
"description": "Default system role.",
"id": 1,
"removable": true,
"users_count": 1,
"created_at": "2017-04-20 16:47:59",
"updated_at": "2017-04-27 10:47:59"
}
}# Update Role
PATCH
/roles/{id}# Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| name | String | No | Role name for using it within the code. |
| display_name | String | No | Role display name. |
| description | String | No | A short role description. |
# Example Request
curl --location --request PATCH 'https://yourwebsite.com/api/roles/123' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer {api_key}' \
--header 'Authorization: Bearer {api_key}' \
--data-raw '{
"name": "my_role",
"display_name": "My Role",
"description": "Default system role."
}'# Example Response
{
"data": {
"name": "my_role",
"display_name": "My Role",
"description": "Default system role.",
"id": 1,
"removable": true,
"users_count": 1,
"created_at": "2017-04-20 16:47:59",
"updated_at": "2017-04-27 10:47:59"
}
}# Delete Role
DELETE
/roles/{id}# Example Request
curl --location --request DELETE 'https://yourwebsite.com/api/roles/123' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer {api_key}' \
--header 'Authorization: Bearer {api_key}'# Example Response
Status: 200 OK
{
"success": true
}# Get Permissions
GET
/roles/{id}/permissions# Example Request
curl --location --request GET 'https://yourwebsite.com/api/roles/123/permissions' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer {api_key}' \
--header 'Authorization: Bearer {api_key}'# Example Response
{
"data": [
{
"name": "users.create",
"display_name": "Create Users",
"description": "Allows user creation.",
"id": 1,
"removable": true,
"created_at": "2017-04-20 16:47:59",
"updated_at": "2017-04-27 10:47:59"
},
// ...
]
}# Update Permissions
POST
/roles/{id}/permissions# Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| permissions | Array | Yes | A list of permission IDs to assign to the given role |
# Example Request
curl --location --request GET 'https://yourwebsite.com/api/roles/123/permissions' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer {api_key}' \
--header 'Authorization: Bearer {api_key}' \
--data-raw '{
"permissions": [
1,
2,
3
]
}'# Example Response
{
"data": [
{
"name": "users.create",
"display_name": "Create Users",
"description": "Allows user creation.",
"id": 1,
"removable": true,
"created_at": "2017-04-20 16:47:59",
"updated_at": "2017-04-27 10:47:59"
},
// ...
]
}← Sessions Permissions →