Modifying a Scheduled Task
Function
Modify 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
PUT /v2/{project_id}/scheduled-tasks/{task_id}
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
project_id |
Yes |
String |
Project ID. |
task_id |
Yes |
String |
Task ID. |
Request 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. |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
scheduled_type |
No |
String |
Execution period type. The options are as follows:
|
day_interval |
No |
Integer |
If the period is by day, the task is executed at an interval of x days. |
week_list |
No |
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 |
No |
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 |
No |
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 |
No |
String |
If the period is specified, the value is a specified date in yyyy-MM-dd. |
scheduled_time |
No |
String |
Specified execution time. The format is HH:mm:ss. |
expire_time |
No |
String |
Expiration time in yyyy-MM-dd HH:mm:ss. |
gray_count |
No |
Integer |
Number of gray objects. The priority is higher than that of gray_desktop_ids. Only script execution is supported. |
gray_desktop_ids |
No |
Array of strings |
Specifies the desktop ID list for gray execution. The priority of this parameter is lower than that of gray_count. Only script execution is supported. |
gray_fail_threshold |
No |
Integer |
Gray failure threshold. When the number of gray execution failures reaches the value of this parameter, the next batch of tasks are not executed. Only script execution is supported. |
life_cycle_type |
No |
String |
Triggering condition. 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). |
time_zone |
No |
String |
Time zone. |
task_name |
No |
String |
Task name. |
force_execute |
No |
Boolean |
Whether to force execute the task. |
description |
No |
String |
Description. |
enable |
No |
Boolean |
Enabled or not. |
extra_params |
No |
String |
Extended parameter in JSON format. |
apply_objects |
No |
Array of ApplyObject objects |
Objects to which a scheduled task applies. |
priority |
No |
Integer |
Specifies the rule priority. This parameter is used for triggered tasks. |
is_gray |
No |
Boolean |
Indicates whether a task is executed in gray mode, which is used by remote scripts. |
wait_time |
No |
Integer |
Waiting duration after a triggered task is triggered. |
Response Parameters
Status code: 200
Normal.
Status code: 400
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
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
{ "scheduled_type" : "FIXED_TIME", "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", "gray_count" : 1000, "gray_desktop_ids" : [ "string" ], "gray_fail_threshold" : 1000, "life_cycle_type" : "string", "time_zone" : "Asia/Shanghai", "task_name" : "Test task", "force_execute" : false, "description" : "A description.", "enable" : true, "extra_params" : "{ \"notify_message\": \"Test\" }", "apply_objects" : [ { "object_id" : "2b31e-d520xxxx-xxebedb6-e57xxxxxx", "object_type" : "DESKTOP" } ], "priority" : 50, "is_gray" : true, "wait_time" : 43200 }
Example Responses
None
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.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot