Help Center/ Workspace/ API Reference/ Workspace APIs/ Scheduled Tasks/ Querying Details About a Scheduled Task
Updated on 2025-07-14 GMT+08:00

Querying Details About a Scheduled Task

Function

Query details about a scheduled 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}/scheduled-tasks/{task_id}

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Project ID.

task_id

Yes

String

Task ID.

Request Parameters

Table 2 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.

Response Parameters

Status code: 200

Table 3 Response body parameters

Parameter

Type

Description

id

String

Task ID.

task_type

String

Task type START: start; STOP: stop; REBOOT: restart; HIBERNATE: hibernate; REBUILD: rebuild the system disk; EXECUTE_SCRIPT: execute the script. If scheduled_type is set to LIFE_CYCLE, START and REBUILD are not supported.

task_name

String

Task name.

force_execute

Boolean

Indicates whether to forcibly execute the task.

scheduled_type

String

Execution period type. FIXED_TIME: specified time; DAY: by day; WEEK: by week; MONTH: by month; LIFE_CYCLE: triggered in a specified scenario.

life_cycle_type

String

Triggering scenario type. This parameter is valid only when scheduled_type is set to LIFE_CYCLE. POST_CREATE_DESKTOP_SUCCESS: After the desktop is successfully created. POST_REBUILD_DESKTOP_SUCCESS: After the desktop is successfully rebuilt. POST_REATTACH_DESKTOP_SUCCESS: After the user assignment task for triggering the rebuilding is successful.

day_interval

Integer

If the period is by day, the task is executed at an interval of x days.

week_list

String

When this parameter is set to WEEK, the value ranges from 1 to 7, corresponding to Sunday to Saturday, respectively. The values are separated by commas (,), for example, 1,2,7.

month_list

String

If the period is by month, the value ranges from 1 to 12. Multiple values are separated by commas (,), for example, 1,3,12.

date_list

String

If the period is by month, the value ranges from 1 to 31 and L (indicating the last day of the current month). The values are separated by commas (,), for example, 1,2,28,L.

scheduled_date

String

If the period is specified, the value is a specified date in yyyy-MM-dd.

scheduled_time

String

Specified execution time. The format is HH:mm:ss.

expire_time

String

Expiration time in yyyy-MM-dd HH:mm:ss.

description

String

Description.

extra_params

String

Extended parameter in JSON format.

apply_objects

Array of ApplyObject objects

Objects to which a scheduled task applies.

gray_count

Integer

Number of objects for grayscale release. This parameter takes precedence over gray_desktop_ids.

gray_desktop_ids

Array of strings

IDs of the desktops for grayscale release. gray_count takes precedence over this parameter.

gray_fail_threshold

Integer

Grayscale release failure threshold. When the number of grayscale release failures reaches the value of this parameter, the next batch of tasks will not be executed.

time_zone

String

Time zone.

wait_time

Integer

Waiting duration after a triggered task is triggered.

Table 4 ApplyObject

Parameter

Type

Description

object_id

String

Object ID.

object_type

String

Object type. Options:

  • DESKTOP: desktop

  • DESKTOP_POOL: desktop pool

  • ALL_DESKTOPS: all desktops

  • DESKTOP_TAG: desktop tag

object_name

String

Object name.

Status code: 400

Table 5 Response body parameters

Parameter

Type

Description

error_code

String

Error code, which is returned upon failure.

error_msg

String

Error description.

error_detail

String

Error details.

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 6 Response body parameters

Parameter

Type

Description

error_code

String

Error code, which is returned upon failure.

error_msg

String

Error description.

error_detail

String

Error details.

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

None

Example Responses

Status code: 200

Normal.

{
  "id" : "2b31e-d520xxxx-xxebedb6-e57xxxxxx",
  "task_type" : "START",
  "task_name" : "Test task",
  "force_execute" : true,
  "scheduled_type" : "FIXED_TIME",
  "life_cycle_type" : "string",
  "day_interval" : 1,
  "week_list" : "1,2,7",
  "month_list" : "1,3,12",
  "date_list" : "1,2,28,L",
  "scheduled_date" : "2022-12-23",
  "scheduled_time" : "09:00:00",
  "expire_time" : "2022-12-31 09:00:00",
  "description" : "A description.",
  "extra_params" : "{ \"notify_message\": \"Test\" }",
  "apply_objects" : [ {
    "object_id" : "2b31e-d520xxxx-xxebedb6-e57xxxxxx",
    "object_type" : "DESKTOP",
    "object_name" : "Test desktop"
  } ],
  "gray_count" : 0,
  "gray_desktop_ids" : [ "string" ],
  "gray_fail_threshold" : 0,
  "time_zone" : "GMT+8",
  "wait_time" : 0
}

Status Codes

Status Code

Description

200

Normal.

400

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

500

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

Error Codes

See Error Codes.