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

Creating a User

Scenario

This interface is invoked to add a business user for a tenant on AppCube.

Method

Post

URI

https://Domain name/apiacces /rest/sum/v1/tenantSpaces/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

Yes

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

Yes

The value is application/json.

Table 2 Request body parameters

No.

Parameter

Mandatory or Not

Type

Description

1

userAccount

Yes

String

User account of a tenant, which is used for subsequent login.

The value can contain 3 to 64 characters (default password rule) and cannot contain the following characters:

"'\<>\¦&\s/©®

\s indicates any blank character, such as a space, tab, or form feed.

2

userName

Yes

String

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

3

phone

No

String

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

4

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.

5

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, the default value Operator is used. Administrator and Operator indicate administrator permissions and common operations permissions, respectively.

6

description

No

String

This parameter applies only to the OP integrated deployment environment.

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

7

password

Yes

String

This parameter applies only to the OP integrated deployment environment.

Login password of a user, which is transmitted using HTTPS.

The value can contain 8 to 20 characters (default password rule). By default, the value must contain four types of characters: uppercase letters, lowercase letters, digits, and special characters.

Supported special characters are as follows: ~`!@#$ %^*()-+_=\¦, ./<>?;':"[]{}\&

8

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

9

orgId

No

String

This parameter applies only to the OP integrated deployment environment.

OU ID, which is optional. New users are automatically added to the top-level OU.

10

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

11

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.

12

salt

No

String

This parameter applies only to the OP integrated deployment environment.

Salt value used for password encryption for transmission.

The encryption algorithm is specified by the SUM. The SUM provides an interface for modifying the number of iterations and KeyLength.

Response Description

  • Status code: 200
    Table 3 Response body parameters

    No.

    Parameter

    Type

    Description

    1

    message

    String

    User description.

    2

    retcode

    String

    Error code. The options are as follows:

    0: success

    Other values: failure

    3

    result

    Object

    Result returned after a successful query.

    Table 4 Parameter of the Result object

    No.

    Parameter

    Type

    Description

    1

    userId

    String

    Unique tenant account ID 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 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: Create a user.

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

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

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

  • Response message
{
"message": "",
"retcode": "0",
"result": {
"userId": "2461227935"
}
}