Skip to main content

"assignRolesToAccounts" (jsonAction)

Add and remove accounts from roles

Links: Concepts | Tutorials | FAQs

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"
}

The "assignRolesToAccounts" API allows administrators to modify user account roles by adding or removing them. Requests use "params" with "add" and "remove" objects to specify roles and users. "Add" and "remove" properties are arrays of objects, each containing "rolenames" and "usernames". The summary table outlines these properties, their descriptions, defaults, types, and limitations for both adding and removing roles.

assignRolesToAccounts
assignRoleToAccount
assignRoleToAccounts
assignsRoleToAccount
assignsRolesToAccounts
assign role to account
admin API
API action
JSON ADMIN API
jsonAction
add user roles
remove user roles
user role management
role names
admin actions
Table 1. "params" 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.