Skip to content
This repository has been archived by the owner on Jun 27, 2024. It is now read-only.

Latest commit

 

History

History
77 lines (60 loc) · 2.93 KB

File metadata and controls

77 lines (60 loc) · 2.93 KB

Update Role

HTTP MethodURLRequires Auth
POST/api/v1/roles.updateyes

Body Parameters

KeyExample ValueDescription
roleId*646c431fa8c3a3ba32d0e1c4The role ID that you want to update.
name*newRoleThe updated name of the role.
scopeSubscriptionsThe updated scope of the role. The default value is Users.
descriptionRole descriptionUpdated description for the role.
mandatory2fatrueWhether the role should have a mandatory 2FA. The default value is false.

Example Call

curl --location 'http://localhost:3000/api/v1/roles.update' \
--header 'X-User-Id: rbAXPnMktTFbNpwtJ' \
--header 'X-Auth-Token: 3K3OqbQcU9H6FiZNEE5lxTTEfXyWxypWRJjvl_2ySOm' \
--header 'Content-Type: application/json' \
--data '{
        "roleId": "646c431fa8c3a3ba32d0e1c4",
        "name": "Test Role",
        "scope": "Users",
        "description": "Testing Role for API",
        "mandatory2fa": false

    }'

Example Response

Success

{
    "role": {
        "_id": "646c431fa8c3a3ba32d0e1c4",
        "name": "update role",
        "scope": "Users",
        "description": "Update Role support tier 1",
        "protected": false,
        "mandatory2fa": false,
        "_updatedAt": "2023-05-23T05:33:33.730Z"
    },
    "success": true
}

Error

Any of the following errors can occur:

  • Authorization: Requires an authentication token for the request to be made.
  • Invalid Role Properties: Occurs when the required payload arguments are not provided when making the request.

{% tabs %} {% tab title=" Authorization" %}

{
    "success": false,
    "error": "unauthorized"
}

{% endtab %}

{% tab title="Invalid Role Properties" %}

{
    "success": false,
    "error": "The role properties are invalid. [error-invalid-role-properties]",
    "errorType": "error-invalid-role-properties"
}

{% endtab %} {% endtabs %}

Change Log

VersionDescription
6.0.0Moved to enterprise edition.