Skip to main content

"assignRolesToAccounts"

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"
        ]
      }
    ]
  },
  "authToken": "replaceWithAuthTokenFromCreateSession",
  "requestId": "1"
}

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

specifies which roles will be added to which accounts

{}

array of objects

add
.rolenames

specifies the roles to be added to the accounts

[]

array

add
.usernames

specifies which account will receive the roles

[]

array

remove

specifies which roles will be added to which accounts

{}

array of objects

remove
.rolenames

specifies the roles to be removed from the accounts

[]

array

remove
.usernames

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.