Updated on 2025-03-31 GMT+08:00

Synchronizing Role Information

Scenario

This interface is invoked to synchronize case role information to the CRM.

Method

Post

URI

https://Domain name/apiaccess/rest/sum/v1/tenantSpaces/roles/users (For example, the domain name is service.besclouds.com.)

Request Description

Table 1 Request header parameters

No.

Parameter

Type

Mandatory or Not

Description

1

X-APP-Key

String

No

App key, which is the user ID. Contact operations personnel to obtain the app key.

2

Authorization

String

Yes

Authentication field. The format is Bearer {Value of AccessToken returned by the tokenByAkSk interface}. (A space is required after Bearer.)

For details about the generation mode, see C1 System Configuration Interface Authentication.

3

Content-Type

String

No

The value is application/json.

Table 2 Request body parameters

No.

Parameter

Mandatory or Not

Type

Description

1

requestBody []

Yes

UserRoles

User role. User roles can be synchronized in batches. The value can contain a maximum of 999 characters.

1.1

actionType

Yes

String

Operation type. The options are as follows:

Grant: permission assignment

Revoke: permission revocation

1.2

userId

Yes

String

User ID.

1.3

roleId

Yes

String

Role ID.

Response Description

  • Status code: 200
    Table 3 Response body parameters

    No.

    Parameter

    Type

    Description

    2

    resCode

    String

    Error code. The options are as follows:

    0: success

    Other values: failure

    3

    resMsg

    String

    • success
    • fail

    4

    result

    Object

    Result returned after a successful query.

    Table 4 Parameter of the Result object

    No.

    Parameter

    Type

    Description

    1

    agentRoleId

    String

    Unique ID of a tenant role generated by the system.

Error Codes

  • Status code: 400

    Incorrect request. Check the request path and parameters.

  • Status code: 401

    Unauthorized operation. 1. Check whether you have purchased related services. 2. Contact the customer service personnel to check the status of your account.

  • Status code: 403

    The authentication fails.

  • Status code: 404

    The requested content is not found. Check the request path.

  • Status code: 500

    Business failure. Check the values of parameters in the request.

Example

Scenario: Synchronize role information.

URL: https://Domain name/apiaccess/rest/sum/v1/tenantSpaces/roles/users

  • Request header
x-app-key:953587d812f642998ee1f633b81212f3
Authorization:Bearer e3fca9398eaa5cef4b57b523b9c75fae
Content-Type:application/json

  • Request message
{
    "requestBody": [{
        "actionType": "Grant",
        "userId": "10gg0000015C8wfbgWbg",
        "roleId": "cH9k0000019M3qH6PKFM"
    },
 {
        "actionType": "Grant",
        "userId": "10gg0000015C8wfbgWbg",
        "roleId": "cH9k0000019AIu9XwdHc"
    }
]}

  • Response message
{
    "resCode": "0",
    "resMsg": "success",
    "result": {
        "agentRoleId": []
    }
}