tencent cloud

APIs

DescribeTasks

Focus Mode
Font Size
Last updated: 2026-04-13 13:07:16

1. API Description

Domain name for API request: postgres.intl.tencentcloudapi.com.

This API is used to query the task list and show the progress of async task execution.
This API is used to show summarized steps, which may be adjusted during version iteration. It is not recommended for key logic usage.

A maximum of 20 requests can be initiated per second for this API.

We recommend you to use API Explorer
Try it
API Explorer provides a range of capabilities, including online call, signature authentication, SDK code generation, and API quick search. It enables you to view the request, response, and auto-generated examples.

2. Input Parameters

The following request parameter list only provides API request parameters and some common parameters. For the complete common parameter list, see Common Request Parameters.

Parameter Name Required Type Description
Action Yes String Common Params. The value used for this API: DescribeTasks.
Version Yes String Common Params. The value used for this API: 2017-03-12.
Region Yes String Common Params. For more information, please see the list of regions supported by the product. This API only supports: ap-bangkok, ap-beijing, ap-chengdu, ap-chongqing, ap-guangzhou, ap-hongkong, ap-jakarta, ap-nanjing, ap-seoul, ap-shanghai, ap-shanghai-fsi, ap-shenzhen-fsi, ap-singapore, ap-tokyo, eu-frankfurt, na-ashburn, na-siliconvalley, sa-saopaulo.
TaskId No Integer Query by task ID. the FlowId and TaskId returned in other cloud apis are equivalent.
DBInstanceId No String Query by database instance ID.
MinStartTime No String Earliest start time of the task, such as 2024-08-23 00:00:00. default shows data within the last 180 days.
MaxStartTime No String Latest start time of the task, such as 2024-08-23 00:00:00, defaults to the current time.
Limit No Integer Number of results displayed per page. value range 1-100. default 20.
Offset No Integer Data offset, starting from 0.
OrderBy No String Sorting field, supports StartTime and EndTime. defaults to StartTime.
OrderByType No String Specifies the sorting method, including ascending: asc and descending: desc. defaults to desc.

3. Output Parameters

Parameter Name Type Description
TotalCount Integer Number of queried tasks.
TaskSet Array of TaskSet Task Information List
RequestId String The unique request ID, generated by the server, will be returned for every request (if the request fails to reach the server for other reasons, the request will not obtain a RequestId). RequestId is required for locating a problem.

4. Example

Example1 Querying the Latest Task Record

This example shows you how to query the latest task record

Input Example

POST / HTTP/1.1
Host: postgres.intl.tencentcloudapi.com
Content-Type: application/json
X-TC-Action: DescribeTasks
<Common request parameters>

{
    "Limit": 1,
    "Offset": 0,
    "OrderBy": "StartTime",
    "OrderByType": "desc"
}

Output Example

{
    "Response": {
        "TaskSet": [
            {
                "TaskId": 1202345,
                "TaskType": "RestoreDatabase",
                "DBInstanceId": "postgres-q6fj84vb",
                "StartTime": "2024-09-27 13:14:11",
                "EndTime": "2024-09-27 13:18:11",
                "Status": "Success",
                "Progress": 100,
                "TaskDetail": {}
            }
        ],
        "RequestId": "3f164712-8746-464f-a490-3084a470000e",
        "TotalCount": 20
    }
}

Example2 Querying a Task with a Specified Task ID

This example shows you how to query a task with a specified task ID

Input Example

POST / HTTP/1.1
Host: postgres.intl.tencentcloudapi.com
Content-Type: application/json
X-TC-Action: DescribeTasks
<Common request parameters>

{
    "TaskId": 120321,
    "Limit": 1
}

Output Example

{
    "Response": {
        "RequestId": "7460a34c-2cf8-4d5c-9346-6977830da6e1",
        "TaskSet": [
            {
                "DBInstanceId": "postgres-0e3hth5b",
                "EndTime": "",
                "Progress": 0,
                "StartTime": "2024-09-27 16:06:02",
                "Status": "Running",
                "TaskDetail": {
                    "AllSteps": "",
                    "Input": "",
                    "Output": ""
                },
                "TaskId": 120321,
                "TaskType": "DestroyInstance"
            }
        ],
        "TotalCount": 1
    }
}

Example3 Querying Tasks for a Specified Instance

This example shows you how to query all tasks of the specified instance by page

Input Example

POST / HTTP/1.1
Host: postgres.intl.tencentcloudapi.com
Content-Type: application/json
X-TC-Action: DescribeTasks
<Common request parameters>

{
    "DBInstanceId": "postgres-q6fj84vb",
    "Limit": 20
}

Output Example

{
    "Response": {
        "RequestId": "53872de1-b750-4aa4-b660-5a3627a44d34",
        "TaskSet": [
            {
                "DBInstanceId": "postgres-q6fj84vb",
                "EndTime": "2024-09-27 13:18:11",
                "Progress": 100,
                "StartTime": "2024-09-27 13:14:11",
                "Status": "Success",
                "TaskDetail": {
                    "AllSteps": "[{\"StepId\":1,\"StepName\":\"Pre-check\"},{\"StepId\":2,\"StepName\":\"Download Base Backup\",\"StepProcess\":100,\"StepMessage\":\"download cos file success, cost time:12 s\"},{\"StepId\":3,\"StepName\":\"Download WAL Logs and Redo\",\"StepProcess\":100,\"StepMessage\":\"specifyBackupSet type ,skip download wal log and redo step\"},{\"StepId\":4,\"StepName\":\"Execute Recovery\"},{\"StepId\":5,\"StepName\":\"Task Complete\"}]",
                    "CurrentStep": "Task Complete",
                    "Input": "{\"RestoreObjects\":[\"postgres\"],\"RestoreType\":\"specifyBackupSet\",\"BackupSetTime\":\"2024-09-26 19:11:45\"}",
                    "Output": "{\"BeforeRestoreObjects\":[\"postgres\"],\"AfterRestoreObjects\":[\"postgres_bak_1727414053\"],\"RestoreType\":\"specifyBackupSet\",\"BackupSetTime\":\"2024-09-26 19:11:45\",\"Message\":\"success\"}"
                },
                "TaskId": 120006,
                "TaskType": "RestoreDatabase"
            },
            {
                "DBInstanceId": "postgres-q6fj84vb",
                "EndTime": "2024-09-27 13:13:31",
                "Progress": 100,
                "StartTime": "2024-09-27 13:09:15",
                "Status": "Success",
                "TaskDetail": {
                    "AllSteps": "[{\"StepId\":1,\"StepName\":\"Pre-check\"},{\"StepId\":2,\"StepName\":\"Download Base Backup\",\"StepProcess\":100,\"StepMessage\":\"download cos file success, cost time:11 s\"},{\"StepId\":3,\"StepName\":\"Download WAL Logs and Redo\",\"StepProcess\":100,\"StepMessage\":\"specifyBackupSet type ,skip download wal log and redo step\"},{\"StepId\":4,\"StepName\":\"Execute Recovery\"},{\"StepId\":5,\"StepName\":\"Task Complete\"}]",
                    "CurrentStep": "Task Complete",
                    "Input": "{\"RestoreObjects\":[\"postgres\"],\"RestoreType\":\"specifyBackupSet\",\"BackupSetTime\":\"2024-09-26T19:11:45+08:00\"}",
                    "Output": "{\"BeforeRestoreObjects\":[\"postgres\"],\"AfterRestoreObjects\":[\"postgres_bak_1727413757\"],\"RestoreType\":\"specifyBackupSet\",\"BackupSetTime\":\"2024-09-26T19:11:45+08:00\",\"Message\":\"success\"}"
                },
                "TaskId": 120005,
                "TaskType": "RestoreDatabase"
            },
            {
                "DBInstanceId": "postgres-q6fj84vb",
                "EndTime": "2024-09-27 12:35:58",
                "Progress": 100,
                "StartTime": "2024-09-27 12:31:50",
                "Status": "Success",
                "TaskDetail": {
                    "AllSteps": "[{\"StepId\":1,\"StepName\":\"Pre-check\"},{\"StepId\":2,\"StepName\":\"Download Base Backup\",\"StepProcess\":100,\"StepMessage\":\"download cos file success, cost time:1 s\"},{\"StepId\":3,\"StepName\":\"Download WAL Logs and Redo\",\"StepProcess\":100,\"StepMessage\":\"specifyBackupSet type ,skip download wal log and redo step\"},{\"StepId\":4,\"StepName\":\"Execute Recovery\"},{\"StepId\":5,\"StepName\":\"Task Complete\"}]",
                    "CurrentStep": "Task Complete",
                    "Input": "{\"RestoreObjects\":[\"postgres\"],\"RestoreType\":\"specifyBackupSet\"}",
                    "Output": "{\"BeforeRestoreObjects\":[\"postgres\"],\"AfterRestoreObjects\":[\"postgres_bak_1727411512\"],\"RestoreType\":\"specifyBackupSet\",\"Message\":\"success\"}"
                },
                "TaskId": 120004,
                "TaskType": "RestoreDatabase"
            },
            {
                "DBInstanceId": "postgres-q6fj84vb",
                "EndTime": "2024-09-27 12:31:28",
                "Progress": 100,
                "StartTime": "2024-09-27 12:30:06",
                "Status": "Success",
                "TaskDetail": {
                    "AllSteps": "[{\"StepId\":1,\"StepName\":\"Pre-check\"},{\"StepId\":2,\"StepName\":\"Download Base Backup\"},{\"StepId\":3,\"StepName\":\"Download WAL Logs and Redo\"},{\"StepId\":4,\"StepName\":\"Execute Recovery\"},{\"StepId\":5,\"StepName\":\"Task Complete\"}]",
                    "CurrentStep": "Task Complete",
                    "Input": "{\"RestoreObjects\":[\"postgres\"],\"RestoreType\":\"timestamp\",\"RestoreTargetTime\":\"2024-09-26 15:20:14\"}",
                    "Output": "{\"BeforeRestoreObjects\":[\"postgres\"],\"AfterRestoreObjects\":[\"postgres_bak_1727411408\"],\"RestoreType\":\"timestamp\",\"RestoreTargetTime\":\"2024-09-26 15:20:14\",\"Message\":\"success\"}"
                },
                "TaskId": 120003,
                "TaskType": "RestoreDatabase"
            },
            {
                "DBInstanceId": "postgres-q6fj84vb",
                "EndTime": "2024-09-27 12:29:04",
                "Progress": 100,
                "StartTime": "2024-09-27 12:24:29",
                "Status": "Success",
                "TaskDetail": {
                    "AllSteps": "[{\"StepId\":1,\"StepName\":\"Pre-check\"},{\"StepId\":2,\"StepName\":\"Download Base Backup\"},{\"StepId\":3,\"StepName\":\"Download WAL Logs and Redo\"},{\"StepId\":4,\"StepName\":\"Execute Recovery\"},{\"StepId\":5,\"StepName\":\"Task Complete\"}]",
                    "CurrentStep": "Task Complete",
                    "Input": "{\"RestoreObjects\":[\"postgres\"],\"RestoreType\":\"timestamp\",\"RestoreTargetTime\":\"2024-09-26 15:20:14\"}",
                    "Output": "{\"BeforeRestoreObjects\":[\"postgres\"],\"AfterRestoreObjects\":[\"postgres_bak_1727411071\"],\"RestoreType\":\"timestamp\",\"RestoreTargetTime\":\"2024-09-26 15:20:14\",\"Message\":\"success\"}"
                },
                "TaskId": 120002,
                "TaskType": "RestoreDatabase"
            },
            {
                "DBInstanceId": "postgres-q6fj84vb",
                "EndTime": "2024-09-27 11:32:50",
                "Progress": 100,
                "StartTime": "2024-09-27 11:29:03",
                "Status": "Success",
                "TaskDetail": {
                    "AllSteps": "[{\"StepId\":1,\"StepName\":\"Pre-check\"},{\"StepId\":2,\"StepName\":\"Download Base Backup\",\"StepProcess\":100,\"StepMessage\":\"download cos file success, cost time:1 s\"},{\"StepId\":3,\"StepName\":\"Download WAL Logs and Redo\",\"StepProcess\":100,\"StepMessage\":\"specifyBackupSet type ,skip download wal log and redo step\"},{\"StepId\":4,\"StepName\":\"Execute Recovery\"},{\"StepId\":5,\"StepName\":\"Task Complete\"}]",
                    "CurrentStep": "Task Complete",
                    "Input": "{\"RestoreObjects\":[\"postgres\"],\"RestoreType\":\"specifyBackupSet\",\"BackupSetId\":\"17083520-3ce6-5b50-9c25-73ff3d4d80b7\"}",
                    "Output": "{\"RestoreObjects\":[\"postgres\"],\"RestoreType\":\"specifyBackupSet\",\"BackupSetId\":\"17083520-3ce6-5b50-9c25-73ff3d4d80b7\",\"RestoreTargetTime\":\"1970-01-01 08:00:00\",\"Message\":\"success\"}"
                },
                "TaskId": 120001,
                "TaskType": "RestoreDatabase"
            }
        ],
        "TotalCount": 6
    }
}

5. Developer Resources

SDK

TencentCloud API 3.0 integrates SDKs that support various programming languages to make it easier for you to call APIs.

Command Line Interface

6. Error Code

The following only lists the error codes related to the API business logic. For other error codes, see Common Error Codes.

Error Code Description
FailedOperation.DatabaseAccessError Failed to access database management service. Please try again later. If the problem persists, please contact customer service.
FailedOperation.DatabaseAffectedError Data operation failed. Please contact customer service.
FailedOperation.FailedOperationError Operation failed. Please try again later.
InvalidParameterValue.InvalidParameterValueError Incorrect parameter value
InvalidParameterValue.ParameterValueExceedError The maximum value of the parameter has been reached.

Help and Support

Was this page helpful?

Help us improve! Rate your documentation experience in 5 mins.

Feedback