Updated on 2025-10-24 GMT+08:00

Querying a Scheduled Task

Function

This API is used to query details about a scheduled O&M task by ID.

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

    coc:schedule:get

    Read

    schedule *

    -

    -

    -

    -

    g:EnterpriseProjectId

URI

GET /v1/schedule/task/{task_id}

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

task_id

Yes

String

Definition

ID of a scheduled task.

Constraints

An existing task.

Range

A string of 26 characters starting with ST.

Default Value

N/A

Request Parameters

None

Response Parameters

Status code: 200

Table 2 Response body parameters

Parameter

Type

Description

id

String

Definition

ID of a scheduled task.

Range

A string of 26 characters starting with ST.

enterprise_project_id

String

Definition

ID of the enterprise project associated with a scheduled task.

Range

Select a project ID that is available inEnterprise Management.

name

String

Definition

Scheduled task name.

Range

The value can contain 3 to 100 characters, including letters, digits, hyphens (-), and underscores (_).

agency_name

String

Definition

Name of the agency associated with a scheduled task.

Range

Agency created in IAM](tag:hws_hk)

trigger_time

TriggerTime object

Definition

Execution policy of a scheduled task.

Range

For details, see the constraints on the value of TriggerTime.

version_no

String

Definition

Version number.

Range

The value contains 1 to 50 characters.

task_type

Object

Definition

Type (script or job) of the task associated with the scheduled task.

Range

  • SCRIPT: script

  • RUNBOOK: job

associated_task_id

String

Definition

ID (script or job ID) of the task associated with the scheduled task.

Range

ID of a task that exists in script management or job management.

associated_task_name

String

Definition

Name (script or job name) of the task associated with the scheduled task.

Range

Name of a task that exists in script or job management.

associated_task_name_en

String

Definition

Name (script or job name) of the associated task.

Range

Name of a task that exists in script or job management.

associated_task_type

String

Definition

Attribute (public or custom) of the task associated with a scheduled task.

Range

  • CUSTOMIZATION: custom script or job

  • COMMUNAL: public script or job

runbook_instance_mode

String

Definition

Target instance mode of a scheduled task.

Range

  • SAME: All job steps are associated with the same instance resource.

  • DIFF: Each task in each job step is associated with an independent instance resource.

risk_level

String

Definition

Risk level of a scheduled task.

Range

  • HIGH

  • MEDIUM

  • LOW

input_param

String

Definition

Execution parameters of the scheduled task.

Range

JSON string, which contains a maximum of 50 key-value pairs. The length of each value is 0 to 16777215 characters. The value must be the same as the execution parameters of the script or job. For example, if the script is used, you need to specify the execution user, timeout interval, and input parameters.

enable_approve

Boolean

Definition

Whether to enable manual review upon data input for a scheduled task.

Range

A boolean value.

reviewer_notification

MessageNotification object

Definition

Reviewer notification information.

Range

For details, see the constraints on the value of MessageNotification.

created_user_name

String

Definition

Nickname of the creator of a scheduled task.

Range

N/A

reviewer_user_name

String

Definition

Nickname of the reviewer of a scheduled task.

Range

N/A

approve_status

Object

Definition

Review status of a scheduled task.

Range

  • PASSED: normal

  • PENDING: to be approved

  • REJECTED: rejected

approve_comments

String

Definition

Review comment of a scheduled task.

Range

N/A

target_instances

String

Definition

Target node of a scheduled task. The value is a JSON string.

Range

N/A

enable_message_notification

Boolean

Definition

Whether to enable notification.

Range

N/A

message_notification

MessageNotification object

Definition

Notification format of a scheduled task.

Range

For details, see the constraints on the value of MessageNotification.

Table 3 TriggerTime

Parameter

Type

Description

time_zone

String

Definition

Time zone.

Constraints

N/A

Range

An existing time zone

Default Value

Asia/Shanghai (GMT+8)

policy

String

Definition

Execution policy of a scheduled task.

Constraints

N/A

Range

  • PERIODIC: The task is executed periodically.

  • ONCE: The task is executed only once.

  • CRON: The task is executed in cron expression.

Default Value

ONCE

single_scheduled_time

Long

Definition

Execution time of a one-off scheduled task.

Constraints

When the scheduled task execution policy is one-off, this parameter is mandatory.

Range

Milliseconds-level UTC timestamp.

Default Value

N/A

periodic_scheduled_time

String

Definition

Daily execution time of a periodic scheduled task.

Constraints

When the scheduled task execution policy is periodic, this parameter is mandatory.

Range

Time string in 24-hour format. If the task is executed at 5:30 PM on the current day, the value is 17:30:00.

Default Value

Current time

period

String

Definition

Week days of a periodic scheduled task.

Constraints

When the scheduled task execution policy is periodic, this parameter is mandatory.

Range

Week days are separated by commas (,). Sunday is 1, and Monday is 2. Example: 1,2,4,5, indicating that the task is executed every Monday, Wednesday, Thursday, and Sunday.

Default Value

N/A

cron

String

Definition

Cron expression of the scheduled task executed based on the cron expression.

Constraints

When the scheduled task execution policy is CRON, this parameter is mandatory.

Range

Use a valid cron expression. For example, if the task is executed at 10:15 AM every day, the value is 0 15 10 ? * *.

Default Value

N/A

scheduled_close_time

Long

Definition

Execution end time of a scheduled task.

Constraints

When the scheduled task execution policy is PERIODIC or CRON, this parameter is mandatory, that is, the timestamp of the scheduled task rule expiration date.

Range

Milliseconds-level UTC timestamp.

Default Value

N/A

Table 4 MessageNotification

Parameter

Type

Description

policy

String

Definition

Notification policy

Constraints

When notification is enabled, this parameter is mandatory. The corresponding notification policy must be specified.

Range

  • START_EXECUTION

  • EXECUTION_FAILED

  • EXECUTION_SUCCEEDED

Default Value

N/A

notification_endpoint_type

String

Definition

Notification object type.

Constraints

N/A

Range

  • USER: individual.

  • ONCALL: shift.

Default Value

ONCALL

schedule_scene_id

String

Definition

ID of the shift scenario.

Constraints

  • When the notification object type is on-call, this parameter is mandatory. That is, you need to specify the shift scenario ID.

If no, create a scenario ID by referring toCreating a Shift Scenario.

Range

N/A

Default Value

N/A

schedule_role_id

String

Definition

ID of the shift role.

Constraints

  • When the notification object type is on-call, this parameter is mandatory. That is, you need to specify the shift role ID.

  • Ensure that the selected role ID exists in the selected shift scenario.

Range

N/A

Default Value

N/A

recipients

String

Definition

Notification recipient ID.

Constraints

  • When the notification object type is individual, you need to specify the ID of the sender.

Ensure that the selected notification recipient ID exists inPersonnel Management.

Range

N/A

Default Value

N/A

protocol

String

Definition

Describes the notification slot.

Constraints

Ensure that the current channel has been subscribed to. For details, see user subscription inPersonnel Management.

Range
  • DEFAULT

  • NONE: no notification.

  • SMS

  • EMAIL

  • DingTalk

  • LARK

  • CALLNOTIFY

  • WECHAT

Default Value

DEFAULT: Select any notification method you have subscribed to. If you have not subscribed to any notification method, you cannot receive notifications.

Status code: 400

Table 5 Response body parameters

Parameter

Type

Description

error_code

String

Definition

Result code.

Range

N/A

error_msg

String

Definition

Error description.

Range

N/A

Example Requests

Query details about a scheduled O&M task by task ID.

GET https://{Endpoint}/v1/schedule/task/ST****

Example Responses

Status code: 200

Request result is returned.

{
  "approve_status" : "PASSED",
  "associated_task_id" : "SC****",
  "associated_task_name" : "script_name",
  "associated_task_type" : "CUSTOMIZATION",
  "created_user_name" : "****",
  "enable_approve" : false,
  "enable_message_notification" : false,
  "enterprise_project_id" : "0",
  "id" : "****",
  "input_param" : "{\"success_rate\":\"100\",\"timeout\":\"300\",\"execute_user\":\"root\",\"project_id\":\"****\",\"script_params\":\"[{\\\"paramName\\\":\\\"parm\\\",\\\"paramValue\\\":\\\"****\\\",\\\"paramOrder\\\":1}]\"}",
  "name" : "11111",
  "risk_level" : "LOW",
  "runbook_instance_mode" : "SAME",
  "target_instances" : "[{\"id\":\"****\",\"schedule_id\":\"ST****\",\"target_selection\":\"MANUAL\",\"target_instances\":\"{\\\"batches\\\":[{\\\"batchIndex\\\":1,\\\"rotationStrategy\\\":\\\"CONTINUE\\\",\\\"targetInstances\\\":[{\\\"resourceId\\\":\\\"****\\\",\\\"regionId\\\":\\\"***\\\",\\\"provider\\\":\\\"HCSS\\\",\\\"type\\\":\\\"L-INSTANCE\\\",\\\"agentSn\\\":\\\"****\\\",\\\"agentStatus\\\":\\\"ONLINE\\\",\\\"nodeId\\\":\\\"\\\",\\\"enterpriseProjectId\\\":\\\"0\\\",\\\"properties\\\":{\\\"hostName\\\":\\\"****\\\",\\\"fixedIp\\\":\\\"\\\",\\\"regionId\\\":\\\"***\\\",\\\"projectId\\\":\\\"****\\\"}}]}],\\\"policy\\\":\\\"none\\\",\\\"all_rotation\\\":\\\"ALL_CONTINUE\\\"}\",\"order_no\":0}]",
  "task_type" : "SCRIPT",
  "trigger_time" : {
    "policy" : "ONCE",
    "single_scheduled_time" : 1746866130000,
    "time_zone" : "Asia/Shanghai"
  },
  "version_no" : "1.0.0"
}

Status Codes

Status Code

Description

200

Request result is returned.

400

The server failed to process the request is returned.

Error Codes

See Error Codes.