Updated on 2024-11-29 GMT+08:00

Querying a Scheduled Task

Function

This API is used to query scheduled tasks based on specified conditions.

URI

GET /v3/{project_id}/scheduled-jobs

Table 1 Path parameters

Name

Mandatory

Type

Description

project_id

Yes

String

Project ID of a tenant in a region. To obtain the project ID, see Obtaining a Project ID.

Table 2 Query parameters

Name

Mandatory

Type

Description

job_name

No

String

Task name. This parameter is left blank by default. The value can be:

RESIZE_FLAVOR: Change vCPUs and memory of an instance.

job_status

No

String

Task execution status. This parameter is left blank by default. Value:

Pending: The task is not executed.

Running: The task is being executed.

Completed: The task is successfully executed.

Failed: The task fails to be executed.

Canceled: The task is canceled.

instance_id

No

String

Instance ID. If this parameter is not specified, all instances that meet the search criteria are queried by default.

start_time

No

String

Task creation start time in the "yyyy-mm-ddThh:mm:ssZ" format. T is the separator between the calendar and the hourly notation of time. Z indicates the time zone offset. For example, if the time zone offset is one hour, the value of Z is +0100. If this parameter is not transferred, the time zone offset is seven days before the current time by default.

end_time

No

String

Task creation end time in the "yyyy-mm-ddThh:mm:ssZ" format. T is the separator between the calendar and the hourly notation of time. Z indicates the time zone offset. For example, if the time zone offset is one hour, the value of Z is +0100. If this parameter is not transferred, the current time is used by default.

offset

No

Integer

The index offset. The query starts from the next piece of data indexed by this parameter. The value is 0 by default.

limit

No

Integer

The number of resources to be queried. If this parameter is not transferred, the default value 10 is used. The value ranges from 1 to 100.

Request Parameters

Table 3 Request header parameters

Name

Mandatory

Type

Description

X-Auth-Token

Yes

String

User token obtained from IAM. For details, see Authentication.

Response Parameters

Table 4 Response body parameters

Name

Type

Description

total_count

Integer

Number of records.

schedules

Array of objects

Task details. See Table 5.

Table 5 schedules

Name

Type

Description

job_id

String

Task ID.

job_name

String

Task name. The value can be:

RESIZE_FLAVOR: Change vCPUs and memory of an instance.

job_status

String

Task execution status. Values:

Running: The task is being executed.

Completed: The task is successfully executed.

Failed: The task fails to be executed.

Pending: The task is not executed.

instance_id

String

DB instance ID.

instance_name

String

DB instance name.

instance_status

String

DB instance status. Values:

createfail: The instance failed to be created.

creating: The instance is being created.

normal: The instance is running properly.

abnormal: The instance is abnormal.

deleted: The instance has been deleted.

create_time

String

Task creation time in the "yyyy-mm-ddThh:mm:ssZ" format. T is the separator between the calendar and the hourly notation of time. Z indicates the time zone offset. For example, if the time zone offset is one hour, the value of Z is +0100.

start_time

String

Task start time in the "yyyy-mm-ddThh:mm:ssZ" format. T is the separator between the calendar and the hourly notation of time. Z indicates the time zone offset. For example, if the time zone offset is one hour, the value of Z is +0100.

end_time

String

Task end time in the "yyyy-mm-ddThh:mm:ssZ" format. T is the separator between the calendar and the hourly notation of time. Z indicates the time zone offset. For example, if the time zone offset is one hour, the value of Z is +0100.

Example Request

Querying the first 10 scheduled tasks of the project whose ID is b02ce40e8cb84a8e980fdb11fac657db

GET https://{endpoint}/v3/b02ce40e8cb84a8e980fdb11fac657db/scheduled-jobs

Example Response

Status code: 200

Success

{ 
  "total_count" : 1, 
  "schedules" : [ { 
    "job_id" : "3861199d-c196-4791-bcd0-b45fde754f50", 
    "job_name" : "RESIZE_FLAVOR", 
    "job_status" : "Pending", 
    "instance_id" : "a2b33e2077ee41e397e57cd2f022b72fin02", 
    "instance_name" : "dds-zzx-recover", 
    "instance_status" : "normal", 
    "create_time" : "2019-05-26T10:41:14+0000", 
    "start_time" : "2019-05-26T10:41:14+0000", 
    "end_time" : "2019-05-26T12:51:14+0000" 
  } ] 
}

SDK

Click Document Database Service DDS SDK to download the SDK or view the SDK document. To learn how to install and authenticate an SDK, read the Usage section.

Status Code

For more information, see Status Code.

Error Code

For more information, see Error Code.