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

Queries desktops.

Function

Queries desktop VMs.

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}/desktops

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

User to whom the desktop belongs.

computer_name

No

String

Desktop name.

desktop_ip

No

String

Desktop IP address.

offset

No

Integer

Start position for pagination query. The value starts from 0.

limit

No

Integer

Pagination query. The value ranges from 0 to 1000 and defaults to 1000.

pool_id

No

String

Desktop pool ID. Use commas (,) to separate multiple desktop pool IDs.

enterprise_project_id

No

String

Enterprise project ID.

desktop_type

No

String

Desktop type. If this parameter is left empty, all desktops are queried. Use commas (,) to separate multiple types.

  • DEDICATED: general desktops, including exclusive desktops and dedicated desktops.

  • SHARED: Multiple users share the desktop.

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

No

String

MIME type of the request body.

Response Parameters

Status code: 200

Table 4 Response body parameters

Parameter

Type

Description

total_count

Integer

Total number of desktops.

desktops

Array of SimpleDesktopInfo objects

Desktop information.

Table 5 SimpleDesktopInfo

Parameter

Type

Description

desktop_id

String

Desktop ID.

computer_name

String

Computer name.

created

String

Creation time.

ip_address

String

Desktop IP address.

user_name

String

Username.

attach_user_infos

Array of AttachInstancesUserInfo objects

List of users to whom desktops have been assigned.

user_group

String

Permission group.

sid

String

SID of the desktop.

ou_name

String

OU name.

enterprise_project_id

String

Enterprise project ID.

in_maintenance_mode

Boolean

In administrator maintenance mode or not.

Table 6 AttachInstancesUserInfo

Parameter

Type

Description

user_id

String

User ID.

user_name

String

User to which a desktop belongs. After a desktop is assigned, the user can log in to the desktop. Only uppercase letters, lowercase letters, digits, hyphens (-), and underscores (_) are allowed. When the domain type is LITE_AD, the value contains 1 to 20 characters starting with a lowercase or uppercase letter. When the domain type is LOCAL_AD, the value contains 1 to 20 characters starting with a lowercase or uppercase letter or digit.

user_group

String

User group to which the desktop user belongs.

  • sudo: Linux administrator group.

  • default: Default Linux user group.

  • administrators: Windows administrator group. Administrators have full access to the desktop and can make any required changes except for forbidden operations.

  • users: Standard Windows user group. Standard users can use most software programs and change system settings that do not affect other users.

Status code: 400

Table 7 Response body parameters

Parameter

Type

Description

error_code

String

Error code, which is returned upon failure.

error_msg

String

Error description.

Status code: 401

Table 8 Response body parameters

Parameter

Type

Description

error_code

String

Error code, which is returned upon failure.

error_msg

String

Error description.

Status code: 403

Table 9 Response body parameters

Parameter

Type

Description

error_code

String

Error code, which is returned upon failure.

error_msg

String

Error description.

Status code: 404

Table 10 Response body parameters

Parameter

Type

Description

error_code

String

Error code, which is returned upon failure.

error_msg

String

Error description.

Status code: 500

Table 11 Response body parameters

Parameter

Type

Description

error_code

String

Error code, which is returned upon failure.

error_msg

String

Error description.

Example Requests

/v2/bcae3e673fd04716a3b9dacdf58ca336/desktops

Example Responses

Status code: 200

Response to the request for querying cloud desktops.

{
  "total_count" : 2,
  "desktops" : [ {
    "desktop_id" : "a6f6e2d1-cc62-46f3-865b-9ae6ae0afde0",
    "computer_name" : "ZRYUAN107",
    "created" : "2022-02-23 04:02:07",
    "ip_address" : "10.0.9.25",
    "user_name" : "zryuan1",
    "user_group" : "administrators",
    "sid" : "3db90102-d11d-4d13-9a96-104696d3c6a3",
    "in_maintenance_mode" : false
  }, {
    "desktop_id" : "248077ea-bb64-4e58-b5e8-6b686600920e",
    "computer_name" : "CHENYC01",
    "created" : "2022-02-22 12:14:59",
    "ip_address" : "10.0.9.103",
    "user_name" : "chenyc",
    "user_group" : "administrators",
    "sid" : "352cf09d-ee15-4ef1-aa49-8d673972b4e6",
    "in_maintenance_mode" : true
  } ]
}

Status Codes

Status Code

Description

200

Response to the request for querying cloud desktops.

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.

500

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

Error Codes

See Error Codes.