Updated on 2026-07-24 GMT+08:00

Creating a Scheduled Upgrade Task

Function

Creates an upgrade task and configures the scheduled task, execution policy, grayscale policy, and application objects.

  • The task name must be unique in the current project.

  • After the task is created, it is executed based on the configured scheduled rule by default.

Debugging

You can debug this API through automatic authentication in API Explorer or use the SDK sample code generated by API Explorer.

Authorization Information

Each account has all the permissions required to call all APIs, but IAM users must be assigned the required permissions.

  • If you are using role/policy-based authorization, see Permissions Policies and Supported Actions for details on the required permissions.
  • If you are using identity policy-based authorization, the following identity policy-based permissions are required.

    Action

    Access Level

    Resource Type (*: required)

    Condition Key

    Alias

    Dependencies

    workspace:upgradeTask:create

    Write

    -

    -

    -

    -

URI

POST /v2/{project_id}/upgrade-task

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Project ID.

Request Parameters

Table 2 Request body parameters

Parameter

Mandatory

Type

Description

task_name

Yes

String

Task name.

task_type

Yes

Integer

Task type. The value can be 0 (cloud desktop), 1 (application server), or 2 (image).

scheduled_type

Yes

String

Execution period type. The value can be FIXED_TIME (specified time), DAY (by day), WEEK (by week), or MONTH (by month).

timezone

Yes

String

Time zone.

week_list

No

String

If the period is by week, the value ranges from 1 to 7. Multiple values are separated by commas (,), for example, 1,2,7.

month_list

No

String

If the period is by month, the value ranges from 1 to 12, separated by commas (,).

date_list

No

String

If the period is by month, the value ranges from 1 to 31 and can be L (indicating the last day of the current month).

day_interval

No

Integer

Number of days to skip.

scheduled_date

No

String

If the period is by specified time, the value indicates the specified date.

scheduled_time

Yes

String

Specified execution time.

is_force_execute

Yes

Integer

Whether to forcibly upgrade the version. The value can be 0 (no) or 1 (yes).

min_version

Yes

String

Upgrade is required if the version is earlier than this version.

target_version

Yes

String

Target version.

expire_enable

Yes

Integer

Whether to enable the expiration time. The value can be 0 (no) or 1 (yes).

expire_time

No

String

Expiration time.

is_notify

Yes

Integer

Whether to send a notification. The value can be 0 (no) or 1 (yes).

extra_params

No

String

Extended parameter (in JSON format).

execute_strategy

Yes

Integer

Execution policy. The value can be 0 (full delivery) or 1 (grayscale delivery).

grayscale_rule

No

Integer

Grayscale rule. The value can be 0 (determined) or 1 (random). This parameter is used when execute_strategy is set to 1.

random_first_batch_count

No

Integer

Random number for the first batch execution.

gray_object_ids

No

String

Grayscale object ID list (in JSON array format).

gray_fail_threshold

No

Integer

First-batch execution failure threshold.

scheduled_end_time

Yes

String

End time of the time window.

is_enable

Yes

Integer

Whether the status is enabled.

description

No

String

Task description.

apply_objects

No

Array of TaskApplyObjectInfo objects

Application object list.

Table 3 TaskApplyObjectInfo

Parameter

Mandatory

Type

Description

object_type

Yes

String

Application object type. The value can be DESKTOP (single desktop), ALL_DESKTOPS (all desktops), DESKTOP_POOL (desktop pool), DESKTOP_TAG (desktop tag), ALL_USERS (all users), USER (single user), USER_GROUP (user group), ALL_IMAGES (all images), APPLICATION_SERVER (application server), or APPLICATION_SERVER_GROUP (application server group).

object_id

No

String

Object ID. The value can be null when object_type is set to ALL_DESKTOPS, ALL_USERS, or ALL_IMAGES.

Response Parameters

Status code: 200

Table 4 Response body parameters

Parameter

Type

Description

task_id

String

Task ID.

Status code: 400

Table 5 Response body parameters

Parameter

Type

Description

error_code

String

Service error code.

error_msg

String

Service error message.

Status code: 500

Table 6 Response body parameters

Parameter

Type

Description

error_code

String

Service error code.

error_msg

String

Service error message.

Example Requests

{
  "task_name" : "Daily Desktop Upgrade Task",
  "task_type" : 0,
  "scheduled_type" : "DAY",
  "timezone" : "Asia/Shanghai",
  "scheduled_time" : "02:00",
  "is_force_execute" : 1,
  "min_version" : "23.0.0",
  "target_version" : "24.6.3",
  "expire_enable" : 1,
  "expire_time" : "2026-12-31 23:59:59",
  "is_notify" : 1,
  "execute_strategy" : 0,
  "scheduled_end_time" : "12:00:00",
  "is_enable" : 1,
  "description" : "Desktop upgrade is performed at 02:00 every day.",
  "apply_objects" : [ {
    "object_type" : "ALL_DESKTOPS",
    "object_id" : null
  } ]
}

Example Responses

None

Status Codes

Status Code

Description

200

ok

400

Invalid request parameter.

500

Internal server error.

Error Codes

See Error Codes.