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

Queries a subtask.

Function

Queries the execution status of an asynchronous job, for example, querying the execution status of desktop creation.

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: The task has been executed.

  • RUNNING: The task is being executed.

  • FAILED: The task failed.

  • WAITING: The task is waiting for execution.

job_id

No

String

Task ID.

job_type

No

String

Task type.

  • createDesktops: creates a desktop task

  • createDesktops: subscribes to Huawei Cloud Workspace

  • cancelWorkspace: deregisters Huawei Cloud Workspace

  • expandVolumes: expands the disk capacity

  • addVolumes: adds a disk

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

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

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 tasks in the task list.

jobs

Array of JobDetailInfo objects

Task list.

Table 5 JobDetailInfo

Parameter

Type

Description

id

String

Task ID.

job_type

String

Task type.

entities

JobEntities object

Job object information, for example, desktop ID, product ID, and username.

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.

message

String

Task failure cause.

job_id

String

Task ID.

desktop_name

String

Desktop name.

ip_address

String

Indicates the IP address.

mac_address

String

Indicates the MAC address.

Table 6 JobEntities

Parameter

Type

Description

desktop_id

String

Desktop ID.

product_id

String

Package ID.

user_name

String

Username.

Status code: 400

Table 7 Response body parameters

Parameter

Type

Description

error_code

String

Error code.

error_msg

String

Error description.

Status code: 401

Table 8 Response body parameters

Parameter

Type

Description

error_code

String

Error code.

error_msg

String

Error description.

Status code: 403

Table 9 Response body parameters

Parameter

Type

Description

error_code

String

Error code.

error_msg

String

Error description.

Status code: 404

Table 10 Response body parameters

Parameter

Type

Description

error_code

String

Error code.

error_msg

String

Error description.

Status code: 405

Table 11 Response body parameters

Parameter

Type

Description

error_code

String

Error code.

error_msg

String

Error description.

Status code: 500

Table 12 Response body parameters

Parameter

Type

Description

error_code

String

Error code.

error_msg

String

Error description.

Status code: 503

Table 13 Response body parameters

Parameter

Type

Description

error_code

String

Error code.

error_msg

String

Error description.

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

You do not have required permissions.

404

No resource found.

405

The request method 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.