Updated on 2024-01-10 GMT+08:00

Querying Users

Function

Query the desktop user list.

Debugging

You can debug this API through automatic authentication in API Explorer or use the SDK sample code generated by API Explorer.

URI

GET /v2/{project_id}/users

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Project ID.

Table 2 Query Parameters

Parameter

Mandatory

Type

Description

user_name

No

String

Specifies the desktop username. The value contains 1 to 20 characters and cannot contain special characters or start with a digit.

limit

No

String

Limits the quantity of returned users in pagination query. If this parameter is not specified, all users that meet the query criteria are returned.

offset

No

String

Start number of records in pagination query.

description

No

String

User description query (fuzzy match).

active_type

No

String

Activation type. The default value is USER_ACTIVATE.

  • USER_ACTIVATE: activated by the user

  • ADMIN_ACTIVATE: activated by the administrator

group_name

No

String

Desktop user group name (exact matching).

Request Parameters

Table 3 Request header parameters

Parameter

Mandatory

Type

Description

X-Auth-Token

Yes

String

User token.

It can be obtained by calling the IAM API that is used to obtain a user token. The value of X-Subject-Token in the response header is the user token.

Content-Type

Yes

String

MIME type of the request body, for example, application/json.

Response Parameters

Status code: 200

Table 4 Response body parameters

Parameter

Type

Description

total_count

Integer

Total number of users.

users

Array of User objects

User list.

Table 5 User

Parameter

Type

Description

id

String

User ID.

user_name

String

Desktop username.

user_email

String

User mailbox.

total_desktops

Integer

Total number of cloud desktops bound to a user.

user_phone

String

Mobile number.

active_type

String

Activation type. The default value is USER_ACTIVATE.

  • USER_ACTIVATE: activated by the user

  • ADMIN_ACTIVATE: activated by the administrator

is_pre_user

Boolean

Indicates whether the user is a pre-created user.

account_expires

String

Account expiration time. 0 indicates that the account never expires.

password_never_expired

Boolean

Indicates whether the password never expires. true indicates that the password never expires, and false indicates that the password will expire.

account_expired

Boolean

Indicates whether the account has expired. true indicates that the account has expired, and false indicates that the account has not expired.

enable_change_password

Boolean

Indicates whether the password can be changed. true indicates that the password can be changed, and false indicates that the password cannot be changed.

next_login_change_password

Boolean

Indicates whether the password needs to be reset upon the next login. true indicates that the password needs to be reset, and false indicates that the password does not need to be reset.

description

String

User description.

locked

Boolean

Indicates whether the account is locked. true indicates that the account is locked, and false indicates that the account is not locked.

disabled

Boolean

Indicates whether the account is disabled. true indicates that the account is disabled, and false indicates that the account is not disabled.

Status code: 400

Table 6 Response body parameters

Parameter

Type

Description

error_code

String

Error code.

error_msg

String

Error description.

Status code: 401

Table 7 Response body parameters

Parameter

Type

Description

error_code

String

Error code.

error_msg

String

Error description.

Status code: 403

Table 8 Response body parameters

Parameter

Type

Description

error_code

String

Error code.

error_msg

String

Error description.

Status code: 404

Table 9 Response body parameters

Parameter

Type

Description

error_code

String

Error code.

error_msg

String

Error description.

Status code: 405

Table 10 Response body parameters

Parameter

Type

Description

error_code

String

Error code.

error_msg

String

Error description.

Status code: 500

Table 11 Response body parameters

Parameter

Type

Description

error_code

String

Error code.

error_msg

String

Error description.

Status code: 503

Table 12 Response body parameters

Parameter

Type

Description

error_code

String

Error code.

error_msg

String

Error description.

Example Requests

GET /v2/0bec5db98280d2d02fd6c00c2de791ce/users?limit=10

Example Responses

Status code: 200

Response to the request for querying the Workspace user list.

{
  "total_count" : 2,
  "users" : [ {
    "id" : "8a2c3f9579d240820179d51e6caf0001",
    "user_name" : "api-test",
    "user_email" : "test@huawei.com",
    "total_desktops" : 0,
    "account_expires" : "0",
    "enable_change_password" : true,
    "next_login_change_password" : true,
    "locked" : false,
    "disabled" : false
  }, {
    "id" : "8a2c3f9579d240820179d51e6caf0002",
    "user_name" : "api-test2",
    "user_email" : "test@huawei.com",
    "total_desktops" : 0,
    "account_expires" : "0",
    "enable_change_password" : true,
    "next_login_change_password" : true,
    "locked" : false,
    "disabled" : false
  } ]
}

Status Codes

Status Code

Description

200

Response to the request for querying the Workspace user list.

400

The request cannot be understood by the server due to malformed syntax.

401

Authentication failed.

403

You do not have required permissions.

404

No resource found.

405

The method specified in the request is not allowed.

500

An internal service error occurred. For details about the error code, see the error code description.

503

The service is unavailable.

Error Codes

See Error Codes.