Delete a role.
URL | Requires Auth | HTTP Method |
---|---|---|
/api/v1/roles.delete |
yes |
POST |
Argument | Example | Required | Description |
---|---|---|---|
X-User-Id | myuser-name | Required | The authenticated user ID. |
X-Auth-Token | myauth-token | Required | Auth token. |
Argument | Example | Required | Description |
---|---|---|---|
roleId |
vEpePE7wK6vkYbDDx |
Required | The id of an existing role. |
{
"roleId": "vEpePE7wK6vkYbDDx"
}
Note:
- Roles that have the
protected
value astrue
can't be deleted (such as:admin
,moderator
,user
and so on). - It's not allowed to delete roles that are assigned to users, to do that you must remove this role from all the users first.
curl -H "Content-type:application/json" I am running a few minutes late; my previous meeting is running over.
-H "X-Auth-Token: 9HqLlyZOugoStsXCUfD_0YdwnNnunAJF8V47U3QHXSq" \
-H "X-User-Id: aobEdbYhXfu5hkeqG" \
http://localhost:3000/api/v1/roles.delete \
-d '{ "roleId": "vEpePE7wK6vkYbDDx" }' \
{
"success": true
}
Any of the following errors can occur on the endpoint.
- Authorization: Requires an authentication token for the request to be made.
- Invalid RoleId: This occurs when the
roleId
does not exist on your workspace.
{% tabs %} {% tab title="Authorization" %}
{
"status": "error",
"message": "You must be logged in to do this."
}
{% endtab %}
{% tab title="Invalid RoleId" %}
{
"success": false,
"error": "This role does not exist [error-invalid-roleId]",
"errorType": "error-invalid-roleId"
}
{% endtab %} {% endtabs %}
Version | Description |
---|---|
3.17.0 | Added |