Assign User Roles


Assign roles to a user.

The existing roles of the user will be overwritten. It is suggested that you use the Get User Roles API to query the existing roles of the user first.

Prerequisites


The application has been granted the “Authorize users in the OU” permission. Contact the OU administrator to get the permission if necessary.

Request Format


POST https://{apigw-address}/app-portal-service/v2.2/role/appendRoles

Request Parameters (Body)


Name

Required/Optional

Data Type

Description

organizationId

Required

String

The OU ID. How to get organizationld>>

userId

Required

String

The user ID. How to get userId >>

roleIds

Required

List

The role ID to be assigned to the user. All specified roles will be assigned to the user. If the user already has a role and it is not in the specified range, the existing role will be overwritten.

Response Parameters


Name

Data Type

Description

data

Boolean

Whether the role is assigned successfully. true means successful assignment, false means failed assignment.

Error Codes


Code

Description

31400

Errors such as incorrect parameters, empty parameters, character limits exceeded, and so on.

31403

The application has not been granted the “Authorize users in this OU” permission.

31404

OU not found.

Samples

Request Sample


url: https://{apigw-address}/app-portal-service/v2.2/role/appendRoles

method: POST

requestBody:
{"organizationId":"yourOrgId", "userId":"yourUserId","roleIds": ["role1","role2","role3"]}

Return Sample


{
  "code": 0,
  "message": "OK",
  "data": true
}