tencent cloud

Feedback

DescribeTasks

Last updated: 2024-11-20 11:12:18

    1. API Description

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

    This API (DescribeTasks) is used to query the list of tasks for a TencentDB instance.

    A maximum of 100 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-20.
    Region Yes String Common Params. For more information, please see the list of regions supported by the product.
    InstanceId No String Instance ID in the format of cdb-c1nl9rpv. It is the same as the instance ID displayed on the TencentDB Console page. You can use the instance list querying API to query the ID, whose value is the InstanceId value in output parameters.
    AsyncRequestId No String ID of an async task request, i.e., AsyncRequestId returned by relevant TencentDB operations.
    TaskTypes.N No Array of Integer Task type. If no value is passed in, all task types will be queried. Valid values:
    1 - rolling back a database;
    2 - performing an SQL operation;
    3 - importing data;
    5 - setting a parameter;
    6 - initializing a TencentDB instance;
    7 - restarting a TencentDB instance;
    8 - enabling GTID of a TencentDB instance;
    9 - upgrading a read-only instance;
    10 - rolling back databases in batches;
    11 - upgrading a primary instance;
    12 - deleting a TencentDB table;
    13 - promoting a disaster recovery instance.
    TaskStatus.N No Array of Integer Task status. If no value is passed in, all task statuses will be queried. Valid values:
    -1 - undefined;
    0 - initializing;
    1 - running;
    2 - succeeded;
    3 - failed;
    4 - terminated;
    5 - deleted;
    6 - paused.
    StartTimeBegin No String Start time of the first task in the format of yyyy-MM-dd HH:mm:ss, such as 2017-12-31 10:40:01. It is used for queries by time range.
    StartTimeEnd No String End time of the last task in the format of yyyy-MM-dd HH:mm:ss, such as 2017-12-31 10:40:01. It is used for queries by time range.
    Offset No Integer Record offset. Default value: 0.
    Limit No Integer Number of results to be returned for a single request. Default value: 20. Maximum value: 100.

    3. Output Parameters

    Parameter Name Type Description
    TotalCount Integer Number of eligible instances.
    Items Array of TaskDetail Information of an instance task.
    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 list of tasks for a TencentDB instance

    This example shows you how to query the list of tasks for a TencentDB instance.

    Input Example

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

    Output Example

    {
        "Response": {
            "TotalCount": 5,
            "Items": [
                {
                    "Code": 9013,
                    "Message": "[Operate CDB Fail][Upgrade Service Fail!] reason: ERR#-999: lock_inst.cgi: no instance records exist for some instance IDs",
                    "JobId": 79,
                    "AsyncRequestId": "9d21004b-3aa1896a-eeddca4b-a68f106d",
                    "Progress": 10,
                    "StartTime": "2019-10-09 20:03:39",
                    "EndTime": "2019-10-09 20:39:34",
                    "InstanceIds": [
                        "cdb-qlfpnobr"
                    ],
                    "TaskType": "OPEN GTID",
                    "TaskStatus": "FAILED"
                },
                {
                    "Code": 0,
                    "Message": "Set parameters successfully",
                    "JobId": 70,
                    "AsyncRequestId": "1d564380-2e391736-f28fa246-43cea3aa",
                    "Progress": 100,
                    "StartTime": "2018-07-06 22:03:05",
                    "EndTime": "2018-07-06 22:03:28",
                    "InstanceIds": [
                        "cdb-6kd9h71i"
                    ],
                    "TaskType": "MODIFY PARAM",
                    "TaskStatus": "SUCCEED"
                },
                {
                    "Code": 0,
                    "Message": "Initialized instance successfully",
                    "JobId": 69,
                    "AsyncRequestId": "ea39295d-420a0b4e-a98298c7-8751e1ad",
                    "Progress": 100,
                    "StartTime": "2018-07-06 22:01:42",
                    "EndTime": "2018-07-06 22:02:26",
                    "InstanceIds": [
                        "cdb-6kd9h71i"
                    ],
                    "TaskType": "INITIAL",
                    "TaskStatus": "SUCCEED"
                },
                {
                    "Code": 0,
                    "Message": "Instance upgrade task is completed",
                    "JobId": 68,
                    "AsyncRequestId": "",
                    "Progress": 100,
                    "StartTime": "2018-07-05 23:53:48",
                    "EndTime": "2018-07-06 22:05:10",
                    "InstanceIds": [
                        "cdb-6kd9h71i"
                    ],
                    "TaskType": "UPGRADE MASTER",
                    "TaskStatus": "SUCCEED"
                },
                {
                    "Code": -1,
                    "Message": "Failed to set parameters",
                    "JobId": 66,
                    "AsyncRequestId": "780b2e32-79cb0f4c-ec7854c5-44ff5371",
                    "Progress": 0,
                    "StartTime": "2018-07-05 23:30:36",
                    "EndTime": "2018-07-05 23:30:37",
                    "InstanceIds": [
                        "cdb-o02fxj9g"
                    ],
                    "TaskType": "MODIFY PARAM",
                    "TaskStatus": "FAILED"
                }
            ],
            "RequestId": "9a4b22f5-0f93-4a72-ba05-1eb6cdf37a1e"
        }
    }
    

    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
    CdbError Backend or process error.
    InternalError.CdbError System error.
    InternalError.DatabaseAccessError Internal database error.
    InternalError.DesError Internal system error.
    InternalError.FtpError File transfer exception
    InternalError.UndefinedError Unknown error
    InternalError.UnknownError Unknown error
    InvalidParameter Parameter error.
    InvalidParameter.InstanceNotFound The instance does not exist.
    InvalidParameterValue.DataConvertError Data conversion failed.
    OperationDenied Operation denied.
    OperationDenied.UserHasNoStrategy This account is not authorized to access the requested resource.
    OperationDenied.WrongStatus The backend task status is invalid.
    Contact Us

    Contact our sales team or business advisors to help your business.

    Technical Support

    Open a ticket if you're looking for further assistance. Our Ticket is 7x24 avaliable.

    7x24 Phone Support