assignRolesToAccounts

Add and remove roles from accounts

Request examples

Minimal

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

Add and remove roles

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

 

Properties

Request properties ("params")

Property Description Default Type Limits (inclusive)

add

The "add" property 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.

Optional with default of {} array of objects

"rolenames"

"usernames"

add

.rolenames

The "roleNames" property specifies the roles to be added to or deleted from the accounts specified by the "usernames" property. This property can specify one or more roles, each between 1 and 64 bytes.

    "add": [
      {
        "roleNames": [
          "admin"
        ],
        "usernames": [
          "NewAccount1"
        ]
      }
    ]
Optional with default of [] array 1 or more strings, each between 1 and 64 bytes.

add

.usernames

The "usernames" property specifies the names of the accounts that the action will target. Optional with default of [] array 0 or more usernames, each between 1 and 64 bytes.

remove

The "remove" property 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.

Optional with default of {} array of objects

"rolenames"

"usernames"

remove

.rolenames

The "roleNames" property specifies the roles to be added to or deleted from the accounts specified by the "usernames" property. This property can specify one or more roles, each between 1 and 64 bytes.

    "add": [
      {
        "roleNames": [
          "admin"
        ],
        "usernames": [
          "NewAccount1"
        ]
      }
    ]
Optional with default of [] array 1 or more strings, each between 1 and 64 bytes.

remove

.usernames

The "usernames" property specifies the names of the accounts that the action will target. Optional with default of [] array 0 or more usernames, each between 1 and 64 bytes.