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

Querying Scheduled Tasks

Function

Query scheduled tasks.

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

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Project ID.

Table 2 Query Parameters

Parameter

Mandatory

Type

Description

offset

Yes

Integer

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

limit

Yes

Integer

Specifies the number of records displayed on each page. The value ranges from 0 to 50.

task_name

No

String

Task name.

task_type

No

String

Task type. The value can be START (starting a desktop), STOP (stopping a desktop), REBOOT (restarting a desktop), HIBERNATE (hibernating a desktop), REBUILD (recomposing the system disk), EXECUTE_SCRIPT (executing a script), or CREATE_SNAPSHOT (creating a snapshot).

scheduled_type

No

String

Execution period type. FIXED_TIME: specified time; DAY: by day; WEEK: by week; MONTH: by month; LIFE_CYCLE: triggered. Triggered tasks are returned only when LIFE_CYCLE is specified.

life_cycle_type

No

String

Triggering condition type. The value can be POST_CREATE_DESKTOP_SUCCESS (after the desktop is created), POST_REBUILD_DESKTOP_SUCCESS (after the desktop is rebuilt), POST_REATTACH_DESKTOP_SUCCESS (after the desktop assignment task for triggering the rebuilding is successfully executed), or POST_DESKTOP_DISCONNECTED (after the desktop is disconnected).

last_status

No

String

Latest execution status. SUCCESS: successful; SKIP: skip; FAIL: failed.

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.

Response Parameters

Status code: 200

Table 4 Response body parameters

Parameter

Type

Description

scheduled_tasks

Array of ScheduledTask objects

Scheduled tasks.

total_count

Integer

Total number.

Table 5 ScheduledTask

Parameter

Type

Description

id

String

Task ID.

task_name

String

Task name.

task_type

String

Task type. The value can be START (starting a desktop), STOP (stopping a desktop), REBOOT (restarting a desktop), HIBERNATE (hibernating a desktop), REBUILD (recomposing the system disk), EXECUTE_SCRIPT (executing a script), or CREATE_SNAPSHOT (creating a snapshot).

scheduled_type

String

Execution interval. FIXED_TIME: specified time. DAY: by day. WEEK: by week. MONTH: by month.

life_cycle_type

String

Triggering scenario type.

last_status

String

Latest execution status. SUCCESS: successful; SKIP: skip; FAIL: failed.

next_execution_time

String

Next execution time. The format is yyyy-MM-dd HH:mm:ss.

enable

Boolean

Indicates whether to enable the function.

description

String

Description.

priority

Integer

Specifies the rule priority. This parameter is used for triggered tasks.

time_zone

String

Time zone.

wait_time

Integer

Waiting duration after a triggered task is triggered.

Status code: 400

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.

Status code: 500

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

Response to the request for querying scheduled tasks.

{
  "scheduled_tasks" : [ {
    "id" : "2b31e-d520xxxx-xxebedb6-e57xxxxxx",
    "task_name" : "Test task",
    "task_type" : "START",
    "scheduled_type" : "FIXED_TIME",
    "life_cycle_type" : "string",
    "last_status" : "SUCCESS",
    "next_execution_time" : "2022-12-23 09:00:00",
    "enable" : true,
    "description" : "A description.",
    "priority" : 0,
    "time_zone" : "string",
    "wait_time" : 0
  } ],
  "total_count" : 10
}

Status Codes

Status Code

Description

200

Response to the request for querying scheduled tasks.

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.