Creates a ticket for clearing historical data.

For more information about the historical data cleaning, see Clear historical data.

This operation can be used only for MySQL databases.


OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer. OpenAPI Explorer dynamically generates the sample code of the operation for different SDKs.

Request parameters

Parameter Type Required Example Description
Action String Yes CreateDataCronClearOrder

The operation that you want to perform. Set the value to CreateDataCronClearOrder.

Comment String Yes test

The purpose or objective of the data change. This reduces unnecessary communication.

RelatedUserList Array of Long No 243253

The stakeholders of this operation. All stakeholders can view the ticket details and assist in the approval process. Irrelevant users other than Data Management (DMS) administrators and database administrators (DBAs) are not allowed to view the ticket details.

Param Object Yes

The parameters of the ticket.

Classify String No test

The reason for the data change.

DbItemList Array Yes

The databases for which you want to clear historical data.

DbId Long Yes 10****

The ID of the database. You can call the SearchDatabases operation to query the ID of the database.

Logic Boolean Yes false

Indicates whether the database is a logical database. Valid values:

  • true: The database is a logical database.
  • false: The database is not a logical database.
CronFormat String Yes 0 0 2 * * ?

The crontab expression that you can use to run the task at a specified time. For more information, see Crontab expression.

CronClearItemList Array Yes

The tables for which you want to clear historical data.

TableName String Yes t1

The name of the table. You can call the ListTables operation to query the name of the table.

ColumnName String Yes gmt_create

The name of the field.

RemainDays Long Yes 7

The retention period of the historical data. Unit: days. For example, if you set the parameter to 7, DMS deletes the data that is retained for more than seven days.


The type of time granularity. If the ColumnName parameter specifies a field of a time type, this parameter is required. Valid values:

  • MILLISECONDS: milliseconds
  • SECONDS: seconds
FilterSQL String No where 1 = 1

The filter conditions.

specifyDuration Boolean Yes true

Specifies whether to specify an end time for the task. Valid values:

  • true: specifies an end time for the task. The task is automatically suspended after this end time.
  • false: does not specify an end time for the task. The task is stopped after the historical data is cleared.
DurationHour Long No 4

The amount of time taken to run the task. Unit: hours.

Note If the specifyDuration parameter is set to true, this parameter is required.
AttachmentKey String No order_attachement.txt

The key of the attachment for the ticket. The attachment provides more instructions for this operation.

You can call the GetUserUploadFileJob operation to query the key of the attachment.

Tid Long No 123454324

The ID of the tenant.

Note The ID of the tenant is displayed when you move the pointer over the profile picture in the upper-right corner of the DMS console. For more information, see the View information about the current tenant section of the Manage DMS tenants topic.
RegionId String No cn-hangzhou

The ID of the region in which DMS is activated. For more information about the valid values of this parameter, see RegionID parameter.

Note Set this parameter to the ID of the region that is in proximity to your applications.

Response parameters

Parameter Type Example Description
RequestId String 0C1CB646-1DE4-4AD0-B4A4-7D47DD52E931

The ID of the request.

Success Boolean true

Indicates whether the request is successful.

ErrorMessage String UnknownError

The error message.

ErrorCode String UnknownError

The error code.

CreateOrderResult Array of Long 1341532

The ID of the ticket.


Sample requests

&Param={"Classify":"test","DbItemList":[{"DbId":10****,"Logic":false}],"CronFormat":"0 0 2 * * ?","CronClearItemList":[{"TableName":"t1","ColumnName":"gmt_create","RemainDays":7,"TimeUnit":"MILLISECONDS","FilterSQL":"where 1 = 1"}],"specifyDuration":true,"DurationHour":4}
&<Common request parameters>

Sample success responses

XML format

HTTP/1.1 200 OK


JSON format

HTTP/1.1 200 OK

  "RequestId" : "0C1CB646-1DE4-4AD0-B4A4-7D47DD52E931",
  "Success" : true,
  "CreateOrderResult" : [ 1341532 ]

Error codes

For a list of error codes, visit the API Error Center.