POST /roles

Use this POST method to create a custom user role or restore predefined user roles to default privileges.

Note: This API requires Lenovo XClarity Administrator v2.4.0 or later.

Authentication

Authentication with user name and password is required.

Request URL

POST https://<management_server_IP>/roles

Query parameters

None

Request body

Table 1. Restore predefined user roles
Attributes Required / Optional Type Description
action Required String Restores predefined user roles to default values. This value is always restore.
The following example restores the predefined roles to the default settings.
{
   "action": "restore"
}
Table 2. Create a custom role
Attributes Required / Optional Type Description
description Required String Role description
existingRole Optional String ID of the existing role on which to base the new role. All privileges in this existing role are added to the new role. To obtain the role ID, use the GET /roles method.
name Required String Name of the role. To obtain the names of predefined and custom roles, use the GET /roles method.
privileges Required Array of string List of URIs that identify the IDs of privileges that are associated with the role (for example, /privileges/3)

To obtain a list of all privilege IDs, use the GET /privileges method.

reserved Required String Indicates if the role is reserved and cannot be used to create new role groups or assigned to new users. This can be one of the following values.
  • true. The user role is reserved.

  • false. The user role is not reserved.

The following example create a custom role.
{
   "description": "A role that allows a user to…",
   "existingRole": "1007",
   "name": "lxc-admin",
   "privileges": ["/privileges/3","/privileges/5"],
   "reserved": false
}

Response codes

Code Description
200 OK
400 Bad request
404 Not found
500 Internal server error

Response body

Attributes Type Description
result String Results of the request. This can be one of the following values.
  • success. The request completed successfully.
  • failed. The request failed. A descriptive error message was returned.
  • warning. The request completed with a warning. A descriptive error message was returned.
messages Array of objects Information about one or more messages
  id String Message identifier of a returned message
  text String Message text associated with the message identifier
  explanation String Additional information to clarify the reason for the message
  recovery Array of objects Recovery information
    text String User actions that can be taken to recover from the event
    URL String Link to the help system for more information, if available

Response example

{
   "result": "success",
   "response": {},
   "messages": [{
      "id": "FQXHMSE0001I",
      "text": "The request completed successfully.",
      "recovery": {
         "text": "Information only. No action is required.",
         "URL": ""
      },
      "explanation": ""
   }]
}