All Products
Search
Document Center

ApsaraDB RDS:DescribeHistoryTasks

Last Updated:Sep 13, 2024

Queries the historical tasks that are created within 30 days.

Operation description

Supported database engines

  • MySQL
  • PostgreSQL
  • SQL Server

References

Note : Before you call this operation, carefully read the following documentation. Make sure that you fully understand the prerequisites and impacts for calling this operation.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer.

Authorization information

The following table shows the authorization information corresponding to the API. The authorization information can be used in the Action policy element to grant a RAM user or RAM role the permissions to call this API operation. Description:

  • Operation: the value that you can use in the Action element to specify the operation on a resource.
  • Access level: the access level of each operation. The levels are read, write, and list.
  • Resource type: the type of the resource on which you can authorize the RAM user or the RAM role to perform the operation. Take note of the following items:
    • The required resource types are displayed in bold characters.
    • If the permissions cannot be granted at the resource level, All Resources is used in the Resource type column of the operation.
  • Condition Key: the condition key that is defined by the cloud service.
  • Associated operation: other operations that the RAM user or the RAM role must have permissions to perform to complete the operation. To complete the operation, the RAM user or the RAM role must have the permissions to perform the associated operations.
OperationAccess levelResource typeCondition keyAssociated operation
rds:DescribeHistoryTasksget
  • All Resources
    *
    none
none

Request parameters

ParameterTypeRequiredDescriptionExample
RegionIdstringYes

The region ID of the pending event. You can call the DescribeRegions operation to query the most recent region list.

cn-beijing
PageSizeintegerNo

The number of entries per page. Valid values: 10 to 100. Default value: 10.

10
PageNumberintegerNo

The page number. Pages start from page 1. Default value: 1.

1
InstanceTypestringNo

Only Instance is supported.

Instance
StatusstringNo

The status of the task. Valid values:

  • Scheduled
  • Running
  • Succeed
  • Failed
  • Cancelling
  • Canceled
  • Waiting

Separate multiple states with commas (,). This parameter is empty by default, which indicates that tasks in all states are queried.

Scheduled
InstanceIdstringNo

The instance ID. Separate multiple instance IDs with commas (,). You can specify up to 30 instance IDs. This parameter is empty by default, which indicates that you can specify an unlimited number of instance IDs.

rm-uf62br2491p5l****
TaskIdstringNo

The task ID. Separate multiple task IDs with commas (,). You can specify up to 30 task IDs. This parameter is empty by default, which indicates that you can specify an unlimited number of task IDs.

t-83br18hloy3faf****
TaskTypestringNo

The task type. Separate multiple task types with commas (,). You can specify up to 30 task types. This parameter is empty by default, which indicates that you can specify an unlimited number of task types.

autotest_dispatch_cases
FromStartTimestringYes

The beginning of the time range to query. Only tasks that have a start time later than or equal to the time specified by this parameter are queried. Specify the time in the ISO 8601 standard in the yyyy-MM-ddTHH:mm:ssZ format. The time must be in UTC. The start time can be up to 30 days earlier than the current time. If you set this parameter to a time more than 30 days earlier than the current time, the specified time is automatically converted to a time that is exactly 30 days earlier than the current time.

2022-01-02T11:31:03Z
ToStartTimestringYes

The end of the time range to query. Only tasks that have a start time earlier than or equal to the time specified by this parameter are queried. Specify the time in the ISO 8601 standard in the yyyy-MM-ddTHH:mm:ssZ format. The time must be in UTC.

2022-03-02T11:31:03Z
FromExecTimeintegerNo

The minimum execution duration of the task. This parameter is used to filter tasks whose execution duration is longer than the minimum execution duration. Unit: seconds. The default value is 0, which indicates that no limit is imposed.

0
ToExecTimeintegerNo

The maximum execution duration of a task. This parameter is used to filter tasks whose execution duration is shorter than or equal to the maximum execution duration. Unit: seconds. The default value is 0, which indicates that no limit is imposed.

0
ResourceGroupIdstringNo

The ID of the resource group.

rg-aekzbvctytru7ua

Response parameters

ParameterTypeDescriptionExample
object

The response parameters.

PageNumberinteger

The page number. Pages start from page 1. Default value: 1.

1
RequestIdstring

The unique ID of the request. If the request fails, provide this ID for technical support to troubleshoot the failure.

5CD61041-35F7-10F7-BE94-33A48B22****
PageSizeinteger

The number of entries per page. Valid values: 10 to 100. Default value: 10.

10
TotalCountinteger

The total number of tasks that meet these constraints without taking pagination into account.

2
Itemsarray<object>

The tasks.

object
Statusinteger

The status of the task.

  • Scheduled
  • Running
  • Succeed
  • Failed
  • Cancelling
  • Canceled
  • Waiting
Running
TaskIdstring

The task ID in the t-*** format.

t-83br18hloy3faf****
CurrentStepNamestring

The name of the current step. If this parameter is left empty, the task is not started.

exec_task
StartTimestring

The start time of the task. The time follows the ISO 8601 standard in the YYYY-MM-DDThh:mm:ss format. The time is displayed in UTC.

2022-02-03T11:31:03Z
EndTimestring

The end time of the task. The time follows the ISO 8601 standard in the YYYY-MM-DDThh:mm:ss format. The time is displayed in UTC.

2022-02-03T12:06:17Z
TaskTypestring

The task type or name.

autotest_dispatch_cases
RemainTimeinteger

The estimated amount of time remaining to complete the task. Unit: seconds.

1000
Progressfloat

The task progress. Valid values: 0 to 100.

79.0
RegionIdstring

The region ID.

cn-shanghai
InstanceTypestring

The type of the instance. Example: user instance.

Instance
InstanceIdstring

The instance ID. Example: rm-xxx.

rm-uf62br2491p5l****
InstanceNamestring

The instance name, which is a user-defined alias.

test
DbTypestring

The database type.

mysql
Productstring

The product. Example: rds.

rds
TaskDetailstring

The task details provided in the form of a JSON string. The JSON string can be customized and extended to include additional information about the task. The details vary based on the task type.

{\"callerUid\":\"test\"}
ReasonCodestring

The reason why the current task was initiated.

****
ActionInfostring

A set of allowed actions that can be taken on the task. The system matches the current step name and status of the task to the available actions specified by ActionInfo. If no matching action is found, the current status of the task does not support any action. Example:

  "steps": [
    {
      "step_name": "exec_task", // The name of the step, which matches CurrentStepName.
      "action_info": {    // The actions supported for this step.
        "Waiting": [      // The status, which matches Status.
          "modifySwitchTime" // The action. Multiple actions are supported.
        ]
      }
    },
    {
      "step_name": "init_task", // The name of the step.
      "action_info": {    // The actions supported for this step.
        "Running": [      // The status.
          "cancel",       // The action.
          "pause"
        ]
      }
    }
  ]
}

The system may support the following actions: retry cancel modifySwitchTime: changes the switching or restoration time.

{\"steps\":[{\"action_info\":{\"Waiting\":[\"modifySwitchTime\"]},\"step_name\":\"exec_task\"}]}
Uidstring

The ID of the user to which the resources belong.

141345906006****
CallerSourcestring

The ID of the user who made the request. If CallerSource is set to User, CallerUid indicates the unique ID (UID) of the user.

141345906006****
CallerUidstring

The request source. Valid values: System User

User

Examples

Sample success responses

JSONformat

{
  "PageNumber": 1,
  "RequestId": "5CD61041-35F7-10F7-BE94-33A48B22****",
  "PageSize": 10,
  "TotalCount": 2,
  "Items": [
    {
      "Status": 0,
      "TaskId": "t-83br18hloy3faf****",
      "CurrentStepName": "exec_task",
      "StartTime": "2022-02-03T11:31:03Z",
      "EndTime": "2022-02-03T12:06:17Z",
      "TaskType": "autotest_dispatch_cases",
      "RemainTime": 1000,
      "Progress": 79,
      "RegionId": "cn-shanghai",
      "InstanceType": "Instance",
      "InstanceId": "rm-uf62br2491p5l****",
      "InstanceName": "test",
      "DbType": "mysql",
      "Product": "rds",
      "TaskDetail": "{\\\"callerUid\\\":\\\"test\\\"}",
      "ReasonCode": " ****",
      "ActionInfo": "{\\\"steps\\\":[{\\\"action_info\\\":{\\\"Waiting\\\":[\\\"modifySwitchTime\\\"]},\\\"step_name\\\":\\\"exec_task\\\"}]}",
      "Uid": "141345906006****",
      "CallerSource": "141345906006****",
      "CallerUid": "User"
    }
  ]
}

Error codes

HTTP status codeError codeError messageDescription
400Param.InvalidParam invalidA request parameter error occurred.
400Param.Invalid.TimeEndBeforeStartParam invalid. End time before start timeThe end time cannot be earlier than the start time.

For a list of error codes, visit the Service error codes.

Change history

Change timeSummary of changesOperation
2023-11-20The Error code has changed. The response structure of the API has changedView Change Details
2022-06-20Add OperationView Change Details