Skip to main content

"assignRolesToAccounts" (admin API)

JSON ADMIN "assignRolesToAccounts" action adds and removes accounts from roles

The "assignRolesToAccounts" action adds and removes accounts from roles.

Request examples

{
  "api": "admin",
  "action": "assignRolesToAccounts",
  "params": {
    "add": [
      {
        "roleNames": [
          "admin"
        ],
        "usernames": [
          "NewAccount1",
          "NewAccount2"
        ]
      }
    ]
  },
  "authToken": "replaceWithAuthTokenFromCreateSession"
}
{
  "api": "admin",
  "action": "assignRolesToAccounts",
  "params": {
    "add": [
      {
        "roleNames": [
          "admin"
        ],
        "usernames": [
          "NewAccount1"
        ]
      }
    ],
    "remove": [
      {
        "roleNames": [
          "admin"
        ],
        "usernames": [
          "NewAccount2"
        ]
      }
    ]
  },
  "requestId": "1",
  "authToken": "replaceWithAuthTokenFromCreateSession"
}

Use the assignRolesToAccounts API action to add and remove accounts from roles

assignRolesToAccountsassignRoleToAccountassignRoleToAccountsassignsRoleToAccountassignsRolesToAccountsassign role to accountAPI actionJSON ADMIN APIjsonAction
Table 1. account property summaries

Property

Description

Default

Type

Limits (inclusive)

add

(optional) specifies which roles will be added to which accounts

{}

array of objects

add
.rolenames

(optional) specifies the roles to be added to the accounts

[]

array

add
.usernames

(optional) specifies which account will receive the roles

[]

array

remove

(optional) specifies which roles will be added to which accounts

{}

array of objects

remove
.rolenames

(optional) specifies the roles to be removed from the accounts

[]

array

remove
.usernames

(optional) specifies which accounts will receive the roles

[]

array



The "add" property is an array of objects that specifies which roles will be added to which accounts. You can specify the roles you want to add with the "rolenames" property and the accounts that will be assigned those roles with the "usernames" property.

The "remove" property is an array of objects that specifies which roles will be removed from which accounts. You can specify the roles you want to remove with the "rolenames" property and the accounts to remove them from with the "usernames" property.