Updated on 2025-07-14 GMT+08:00

Querying Subtasks

Function

Queries the execution status of an asynchronous task, such as a desktop creation task.

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}/workspace-sub-jobs

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Project ID.

Table 2 Query Parameters

Parameter

Mandatory

Type

Description

status

No

String

Task status.

  • SUCCESS: succeeded

  • RUNNING: running

  • FAILED: failed

  • WAITING: waiting for execution

job_id

No

String

Task ID. You are advised to set either job_type or job_id, or both.

job_type

No

String

Task type. You are advised to set either job_type or job_id, or both.

  • createDesktops: creating a desktop

  • applyWorkspace: enabling Huawei Cloud Workspace

  • cancelWorkspace: canceling Huawei Cloud Workspace

  • expandVolumes: expanding disk capacity

  • addVolumes: adding a disk

  • rebuildDesktopss: rebuilding a desktop system disk

  • createSnapshot: creating a disk snapshot

  • deleteSnapshot: deleting a disk snapshot

  • deleteDesktops: deleting a desktop

  • desktopRejoinDomain: re-adding a desktop to a domain

  • operateDesktops: performing operations on a desktop

  • restoreDesktopBySnapshot: restoring a desktop using a snapshot

  • desktopToImage: converting a desktop to an image

  • attachDesktops: assigning a desktop

  • deleteVolumes: deleting a desktop disk (data disk)

  • createWksSnapshot: creating a snapshot

  • deleteWksSnapshot: deleting a snapshot

  • createDesktopPool: creating a desktop pool

  • expandDesktopPool: expanding the desktop pool capacity

  • deleteDesktopPoolVolumes: deleting a desktop disk (data disk) from a desktop pool

  • rebuildDesktopPool: rebuilding system disks of a desktop pool

  • addDesktopPoolVolumes: adding a disk to a desktop pool

  • detachDesktops: unbinding a desktop from a desktop pool

  • attachDesktopPool: assigning desktops in a desktop pool

  • batchDetachDesktops: unbinding desktops from users in batches

  • executeDesktopsAction: performing operations on a desktop

  • changeDesktopNetwork: switching the network of a desktop

  • batchChangeDesktopNetwork: switching the network of desktops in batches

desktop_pool_id

No

String

Desktop pool ID.

limit

No

Integer

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

offset

No

Integer

Where the pagination query starts. The value starts from 0.

Request Parameters

Table 3 Request header parameters

Parameter

Mandatory

Type

Description

X-Auth-Token

No

String

User token.

It can be obtained by calling the IAM API 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.

Response Parameters

Status code: 200

Table 4 Response body parameters

Parameter

Type

Description

total_count

Integer

Total number of tasks in the task list.

jobs

Array of JobDetailInfo objects

Task list.

Table 5 JobDetailInfo

Parameter

Type

Description

id

String

Subtask ID.

job_type

String

Task type.

entities

JobEntities object

Task.

begin_time

String

Task creation time.

end_time

String

Task end time.

status

String

Task status.

error_code

String

Error code of a failed task.

fail_reason

String

Task failure cause.

host

String

IP address of the server where the task is executed.

project_id

String

Project ID.

job_id

String

Task ID.

process

Integer

Task progress.

attach_user

String

Associate user.

entity

String

Operation object.

ip_address

String

IP address.

Table 6 JobEntities

Parameter

Type

Description

desktop_id

String

Desktop ID.

product_id

String

Package ID.

user_name

String

Username.

desktop_name

String

Desktop name.

ip_address

String

IP address.

Status code: 400

Table 7 Response body parameters

Parameter

Type

Description

error_code

String

Error code.

error_msg

String

Error message.

encoded_authorization_message

String

Encrypted detailed reason for rejection. You can call the API decode-authorization-message of STS to decrypt the reason.

Status code: 401

Table 8 Response body parameters

Parameter

Type

Description

error_code

String

Error code.

error_msg

String

Error message.

encoded_authorization_message

String

Encrypted detailed reason for rejection. You can call the API decode-authorization-message of STS to decrypt the reason.

Status code: 403

Table 9 Response body parameters

Parameter

Type

Description

error_code

String

Error code.

error_msg

String

Error message.

encoded_authorization_message

String

Encrypted detailed reason for rejection. You can call the API decode-authorization-message of STS to decrypt the reason.

Status code: 404

Table 10 Response body parameters

Parameter

Type

Description

error_code

String

Error code.

error_msg

String

Error message.

encoded_authorization_message

String

Encrypted detailed reason for rejection. You can call the API decode-authorization-message of STS to decrypt the reason.

Status code: 405

Table 11 Response body parameters

Parameter

Type

Description

error_code

String

Error code.

error_msg

String

Error message.

encoded_authorization_message

String

Encrypted detailed reason for rejection. You can call the API decode-authorization-message of STS to decrypt the reason.

Status code: 500

Table 12 Response body parameters

Parameter

Type

Description

error_code

String

Error code.

error_msg

String

Error message.

encoded_authorization_message

String

Encrypted detailed reason for rejection. You can call the API decode-authorization-message of STS to decrypt the reason.

Status code: 503

Table 13 Response body parameters

Parameter

Type

Description

error_code

String

Error code.

error_msg

String

Error message.

encoded_authorization_message

String

Encrypted detailed reason for rejection. You can call the API decode-authorization-message of STS to decrypt the reason.

Example Requests

GET /v2/ac234de25c6741d2b1273da49eea1b9e/workspace-sub-jobs?status=FAILED&status=RUNNING&job_type=createDesktops

null

Example Responses

Status code: 200

Response to task details.

{
  "total_count" : 2,
  "jobs" : [ {
    "status" : "RUNNING",
    "entities" : {
      "user_name" : "user-test-01",
      "product_id" : "workspace.c2.large.windows",
      "desktop_id" : "9d30c8ac-77b5-4453-80da-8f027223ee99"
    },
    "job_id" : "0e2dae94-23ff-449a-bb9c-1b808cf2106d",
    "job_type" : "createDesktops",
    "begin_time" : "2020-04-10 06:45:14",
    "end_time" : "2020-04-10 07:06:10",
    "id" : "e43caef5-e478-4624-9e8c-b0b636331cbc"
  }, {
    "status" : "RUNNING",
    "entities" : {
      "user_name" : "user-test-01",
      "product_id" : "workspace.c2.large.windows",
      "desktop_id" : "14cccba0-12a6-4b66-9fd9-57290328f8da"
    },
    "job_id" : "0e2dae94-23ff-449a-bb9c-1b808cf2106d",
    "job_type" : "createDesktops",
    "begin_time" : "2020-04-10 06:45:14",
    "end_time" : "2020-04-10 07:05:49",
    "id" : "cf5043e9-dd94-43be-9c07-6dba5d43c4d2"
  } ]
}

Status Codes

Status Code

Description

200

Response to task details.

400

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

401

Authentication failed.

403

No operation permissions.

404

No resources found.

405

The method specified in the request is not allowed.

500

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

503

Service unavailable.

Error Codes

See Error Codes.