Add Group To Role
Add a user group to a role definition in RSA Governance & Lifecycle.
POST https://instance.securid.com/aveksa/command.submit?cmd=addGroupToRole
Purpose
The addGroupToRole command adds a specified User Group ID to a specified Role ID. This command requires a POST request where parameters are supplied as URL query parameters rather than in the HTTP request body.
Request
Parameters
| Parameter | Type | Requirement | Description |
|---|---|---|---|
cmd | string | Command name: addGroupToRole. | |
groupId | integer | The ID of the user group to add to the role. | |
roleId | integer | The ID of the role to which the group is added. | |
format | string | Optional | The response format:properties: (Default) Key-value format (key=value). If multiple objects return, values are comma-separated.json: JavaScript Object Notation format. Suitable for programmatic parsing. |
token | string | Deprecated | Session token retrieved from loginUser. Deprecated. Use the Authorization request header instead. |
Request Headers
| Header | Type | Requirement | Description |
|---|---|---|---|
Authorization | string | Bearer token for a user with system administrator privileges, obtained via loginUser. Format: Bearer <token>. | |
Accept | string | Optional | Desired response MIME type (for example, application/json or text/plain). |
Content-Type | string | Optional | Content type header: application/x-www-form-urlencoded or application/json. |
The Authorization request header replaces the deprecated token URL query parameter.
Role management commands currently require an authenticated user session token obtained via loginUser with the Role Administrator capability. While the Web Services Administration console allows mapping Role commands to a Trusted Application, requests using a Trusted Application token (loginTrustedApp) currently return HTTP 403 (Couldn't perform edit action on role).
Response
Parameters
| Parameter | Type | Description |
|---|---|---|
status | string | Execution result: success or failure. |
message | string | Optional status or error diagnostic message returned by the server. |
Examples
Request
- Curl
- Python
- Node.js
- PowerShell
curl -X POST \
"https://instance.securid.com/aveksa/command.submit?cmd=addGroupToRole&groupId=2&roleId=3&format=json" \
-H "Authorization: Bearer <user-token>" \
-H "Accept: application/json"
import requests
url = "https://instance.securid.com/aveksa/command.submit"
params = {
"cmd": "addGroupToRole",
"groupId": 2,
"roleId": 3,
"format": "json"
}
headers = {
"Authorization": "Bearer <user-token>",
"Accept": "application/json"
}
response = requests.post(url, params=params, headers=headers)
if response.status_code == 200:
print(response.json())
else:
print(f"Request failed: {response.status_code} - {response.text}")
const axios = require('axios');
const url = "https://instance.securid.com/aveksa/command.submit";
const params = {
cmd: 'addGroupToRole',
groupId: 2,
roleId: 3,
format: 'json'
};
const headers = {
Authorization: 'Bearer <user-token>',
Accept: 'application/json'
};
axios.post(url, null, { params, headers })
.then(response => {
console.log(response.data);
})
.catch(error => {
console.error('Request failed:', error.response ? error.response.data : error.message);
});
$uri = "https://instance.securid.com/aveksa/command.submit?cmd=addGroupToRole&groupId=2&roleId=3&format=json"
$headers = @{
"Authorization" = "Bearer <user-token>"
"Accept" = "application/json"
}
$response = Invoke-RestMethod -Uri $uri -Method Post -Headers $headers
$response
Response
- 200 OK
- 401 Unauthorized
- 403 Forbidden
- 404 Not Found
- 412 Precondition Failed
JSON Format (format=json):
{
"status": "success",
"message": "Group 2 successfully added to role 3."
}
Properties Format (format=properties):
status=success
message=Group 2 successfully added to role 3.
Missing Token:
<html>
<head><title>Error</title></head>
<body>The token is required for the command 'addGroupToRole'</body>
</html>
Invalid or Expired Token:
<html>
<head><title>Error</title></head>
<body>The token is not valid for the command 'addGroupToRole'. Token is invalid or expired</body>
</html>
Returned when calling with a Trusted Application token without user delegation, or when the user lacks role edit permissions:
<html>
<head><title>Error</title></head>
<body>Couldn't perform edit action on role. Check user authorization or roleset permissions.
Query String=cmd=addGroupToRole&groupId=2&roleId=3&format=json</body>
</html>
<html>
<head><title>Error</title></head>
<body>The role with ID 3 could not be found.
Query String=cmd=addGroupToRole&format=json&groupId=2&roleId=3</body>
</html>
<html>
<head><title>Error</title></head>
<body>The parameter groupId is required and should be a number.
Query String=cmd=addGroupToRole&format=json&roleId=3</body>
</html>
Verified with RSA Governance & Lifecycle version 8.0.0.
References
- Commit Role: Commit pending changes to a role after adding groups
- Remove Group From Role: Remove a user group from a role
- RFC 6750: OAuth 2.0 Bearer Token Usage
- RFC 7235: Hypertext Transfer Protocol (HTTP/1.1) Authentication