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

Modifying a User

Scenario

This interface is invoked to update user information. The PATCH method is used to support partial updates of specified fields in the message body. That is, if the phone field is specified, the phone field is updated; if the email field is specified, the email field is updated.

Method

PATCH

URI

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

URL Parameters

Table 1 URL parameter

No.

Parameter

Mandatory or Not

Type

Description

1

userId

Yes

String

Unique ID of a user of a tenant.

Request Description

Table 2 Request header parameters

No.

Parameter

Type

Mandatory or Not

Description

1

X-APP-Key

String

Yes

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.)

3

Content-Type

String

Yes

The value is application/json.

Table 3 Request body parameters

No.

Parameter

Mandatory or Not

Type

Description

1

userName

No

String

Display name of a user. The value can contain a maximum of 64 characters.

2

phone

No

String

Contact number of a user of a tenant. The value can contain a maximum of 32 characters.

3

email

No

String

Email address of a user of a tenant (in compliance with RFC 2882).

The email address can contain a maximum of 64 characters.

4

profile

No

String

This parameter applies only to the environment where the Case is deployed independently.

Business user permissions. Only Operator or Administrator can be passed. If no value is passed, business user permissions will not be modified.

Administrator and Operator indicate administrator permissions and common operations permissions, respectively.

5

description

No

String

This parameter applies only to the OP integrated deployment environment.

User description. The value can contain a maximum of 540 characters.

6

status

No

Integer

This parameter applies only to the OP integrated deployment environment.

User status. The options are as follows:

0: to be activated

1: activated

2: suspended

3: expired (A user in the expired state can only be deleted.)

7

title

No

String

This parameter applies only to the OP integrated deployment environment.

User position. The options are as follows:

1: service agent

2: VIP service agent

3: team leader

4: online administrator

5: administrator

6: manager

7: configuration administrator

8

gender

No

Integer

This parameter applies only to the OP integrated deployment environment.

Gender. The options are as follows:

0: female

1: male

9: unknown

If this parameter is not specified, the default value 9 is used.

Response Description

  • Status code: 200
    Table 4 Response body parameters

    No.

    Parameter

    Type

    Description

    1

    message

    String

    Description.

    2

    retcode

    String

    Error code. The options are as follows:

    0: success

    Other values: failure

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 customer service 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: Modify a user.

URL: https://Domain name/apiaccess/rest/sum/v1/tenantSpaces/users/{userId}

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

  • Request message
{
"userName":"userName01",
"phone":"12012341234",
"email":"test@huawei.com",
"profile":"Operator"
}

  • Response message
{
"message": "",
"retcode": "0"
}