Create a new role

Use Create New RoleAPI to create a new role with permissions in the Control Room.

Prerequisites

View and Manage Roles
Users who have view and manage roles permissions can view, create, and manage roles.
JSON Web Token (JWT)
All Control Room APIs require a JSON Web Token (JWT) to access the APIs. Generate an authentication token using the Authentication API. See Enterprise 11 Authentication API.
  • URL: http://<your_control_room_url>/v1/usermanagement/roles

    Replace the content in the angle brackets with your Control Room URL.

  • Method: POST.
  • Use the Swagger definition files installed with your Control Room to test the APIs. View the available Swagger APIs at: http://<your_control_room_url>/swagger/.
  • You can also use a REST client to complete this task.

Procedure

  1. Add an authentication token to the request header.
    Use the Authentication API to generate a JSON Web Token. See Enterprise 11 Authentication API.
  2. Select POST as the method.
    POST http://<your_control_room_url>/v1/usermanagement/roles
  3. In the request body, enter a new name for the role.
  4. Send the request.
    Parameter name Mandatory Type Description
    Name Yes String (255 max) Role Name
    Description No String (255 max) Role description

    The following request creates a new role with the following permissions: ID, action, and the resourceType.

    Request body:
    {
      "name": "User-Role-Management",
      "description": "",
      "permissions": [
        {
          "id": 58,
          "action": "myschedule",
          "resourceType": "taskscheduling",
          "resourceId": null
        },
        {
          "id": 59,
          "action": "managecredentials",
          "resourceType": "credentials",
          "resourceId": null
        },
        {
          "id": 30,
          "action": "view",
          "resourceType": "devices",
          "resourceId": null
        },
        {
          "id": 97,
          "action": "viewbotstore",
          "resourceType": "botstore",
          "resourceId": null
        },
        {
          "id": 102,
          "action": "viewuserbasic",
          "resourceType": "usermanagement",
          "resourceId": null
        },
        {
          "id": 3,
          "action": "createuser",
          "resourceType": "usermanagement",
          "resourceId": null
        },
        {
          "id": 4,
          "action": "updateuser",
          "resourceType": "usermanagement",
          "resourceId": null
        },
        {
          "id": 2,
          "action": "deleteuser",
          "resourceType": "usermanagement",
          "resourceId": null
        },
        {
          "id": 1,
          "action": "usermanagement",
          "resourceType": "usermanagement",
          "resourceId": null
        },
        {
          "id": 12,
          "action": "rolesmanagement",
          "resourceType": "rolesmanagement",
          "resourceId": null
        },
        {
          "id": 90,
          "action": "rolesview",
          "resourceType": "rolesmanagement",
          "resourceId": null
        }
      ],
      "principals": []
    }
  5. Send the request.
    • In Swagger, click Execute.
    • In a REST client, click SEND.
    Response body:
    {
      "id": 42,
      "createdBy": 36,
      "createdOn": "2019-12-26T19:51:24Z",
      "updatedBy": 36,
      "updatedOn": "2019-12-26T19:51:24Z",
      "tenantId": 1,
      "version": 0,
      "status": "Active",
      "description": "",
      "name": "User-Role-Management",
      "accessRestriction": null,
      "permissions": [{
        "id": 1,
        "createdBy": 0,
        "createdOn": "2019-10-03T23:53:35Z",
        "updatedBy": 0,
        "updatedOn": "2019-10-03T23:53:35Z",
        "tenantId": 1,
        "version": 0,
        "status": null,
        "action": "usermanagement",
        "resourceId": null,
        "resourceType": "usermanagement"
      }, {
        "id": 59,
        "createdBy": 0,
        "createdOn": "2019-10-03T23:53:47Z",
        "updatedBy": 0,
        "updatedOn": "2019-10-03T23:53:47Z",
        "tenantId": 1,
        "version": 0,
        "status": null,
        "action": "managecredentials",
        "resourceId": null,
        "resourceType": "credentials"
      }, {
        "id": 2,
        "createdBy": 0,
        "createdOn": "2019-10-03T23:53:35Z",
        "updatedBy": 0,
        "updatedOn": "2019-10-03T23:53:35Z",
        "tenantId": 1,
        "version": 0,
        "status": null,
        "action": "deleteuser",
        "resourceId": null,
        "resourceType": "usermanagement"
      }, {
        "id": 4,
        "createdBy": 0,
        "createdOn": "2019-10-03T23:53:35Z",
        "updatedBy": 0,
        "updatedOn": "2019-10-03T23:53:35Z",
        "tenantId": 1,
        "version": 0,
        "status": null,
        "action": "updateuser",
        "resourceId": null,
        "resourceType": "usermanagement"
      }, {
        "id": 12,
        "createdBy": 0,
        "createdOn": "2019-10-03T23:53:35Z",
        "updatedBy": 0,
        "updatedOn": "2019-10-03T23:53:35Z",
        "tenantId": 1,
        "version": 0,
        "status": null,
        "action": "rolesmanagement",
        "resourceId": null,
        "resourceType": "rolesmanagement"
      }, {
        "id": 90,
        "createdBy": 0,
        "createdOn": "2019-10-03T23:54:11Z",
        "updatedBy": 0,
        "updatedOn": "2019-10-03T23:54:11Z",
        "tenantId": 1,
        "version": 0,
        "status": null,
        "action": "rolesview",
        "resourceId": null,
        "resourceType": "rolesmanagement"
      }, {
        "id": 58,
        "createdBy": 0,
        "createdOn": "2019-10-03T23:53:47Z",
        "updatedBy": 0,
        "updatedOn": "2019-10-03T23:53:47Z",
        "tenantId": 1,
        "version": 0,
        "status": null,
        "action": "myschedule",
        "resourceId": null,
        "resourceType": "taskscheduling"
      }, {
        "id": 3,
        "createdBy": 0,
        "createdOn": "2019-10-03T23:53:35Z",
        "updatedBy": 0,
        "updatedOn": "2019-10-03T23:53:35Z",
        "tenantId": 1,
        "version": 0,
        "status": null,
        "action": "createuser",
        "resourceId": null,
        "resourceType": "usermanagement"
      }, {
        "id": 97,
        "createdBy": 0,
        "createdOn": "2019-10-03T23:54:12Z",
        "updatedBy": 0,
        "updatedOn": "2019-10-03T23:54:12Z",
        "tenantId": 1,
        "version": 0,
        "status": null,
        "action": "viewbotstore",
        "resourceId": null,
        "resourceType": "botstore"
      }, {
        "id": 30,
        "createdBy": 0,
        "createdOn": "2019-10-03T23:53:37Z",
        "updatedBy": 0,
        "updatedOn": "2019-10-03T23:53:37Z",
        "tenantId": 1,
        "version": 0,
        "status": null,
        "action": "view",
        "resourceId": null,
        "resourceType": "devices"
      }, {
        "id": 102,
        "createdBy": 0,
        "createdOn": "2019-11-21T19:08:20Z",
        "updatedBy": 0,
        "updatedOn": "2019-11-21T19:08:20Z",
        "tenantId": 1,
        "version": 0,
        "status": "Active",
        "action": "runtimeclientsmanagement",
        "resourceId": "2",
        "resourceType": "runtimeclientsmanagement"
      }],
      "countPrincipals": 0,
      "principals": []
    }
Note: You can also run REST requests from a command terminal. The following is a curl request example. This example is formatted for readability. Replace the text inside the angle brackets, <authentication_token>, with your authentication token.
curl -X POST "http://<your_control_room_url>/v1/usermanagement/roles" 
-H "accept: application/json" 
-H "X-Authorization: <authentication_token>" 
-H "Content-Type: application/json" -d '{
  "name": "User-Role-Management",
  "description": "",
  "permissions": [
    {
      "id": 58,
      "action": "myschedule",
      "resourceType": "taskscheduling",
      "resourceId": null
    },
    {
      "id": 59,
      "action": "managecredentials",
      "resourceType": "credentials",
      "resourceId": null
    },
    {
      "id": 30,
      "action": "view",
      "resourceType": "devices",
      "resourceId": null
    },
    {
      "id": 97,
      "action": "viewbotstore",
      "resourceType": "botstore",
      "resourceId": null
    },
    {
      "id": 102,
      "action": "viewuserbasic",
      "resourceType": "usermanagement",
      "resourceId": null
    },
    {
      "id": 3,
      "action": "createuser",
      "resourceType": "usermanagement",
      "resourceId": null
    },
    {
      "id": 4,
      "action": "updateuser",
      "resourceType": "usermanagement",
      "resourceId": null
    },
    {
      "id": 2,
      "action": "deleteuser",
      "resourceType": "usermanagement",
      "resourceId": null
    },
    {
      "id": 1,
      "action": "usermanagement",
      "resourceType": "usermanagement",
      "resourceId": null
    },
    {
      "id": 12,
      "action": "rolesmanagement",
      "resourceType": "rolesmanagement",
      "resourceId": null
    },
    {
      "id": 90,
      "action": "rolesview",
      "resourceType": "rolesmanagement",
      "resourceId": null
    }
  ],
  "principals": []
}'