Creates a ticket for importing data to Data Management (DMS).

For more information about the Large Data Import feature, see Import data.

Debugging

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 CreateDataImportOrder

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

Comment String Yes test

The purpose or objective of the data import. This parameter is used to help reduce unnecessary communication.

RelatedUserList Array of Long No 51****

The stakeholders of the data import. All stakeholders can view the ticket details and assist in the approval process. Irrelevant users other than 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 import.

AttachmentName String Yes order_text

The key of the attachment that contains the SQL statements used to import data. You can call the GetUserUploadFileJob operation to the attachment key from the value of the AttachmentKey parameter.

DbItemList Array Yes

The database to which you want to import data. You can specify only one database.

DbId Long Yes 1860****

The ID of the database. The database can be a physical database or a logical database.

Logic Boolean Yes false

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

  • true: The database is a logical database.
  • false: The database is a physical database.
Note If you set this parameter to true, the database that you specify must be a logical database.
FileType String Yes CSV

The format of the file for the data import. Valid values:

  • SQL: an SQL file
  • CSV: a CSV file
FileEncoding String No AUTO

The encoding algorithm to be used by the destination database. Valid values:

  • AUTO: automatic identification
  • UTF-8: UTF-8 encoding
  • GBK: GBK encoding
  • ISO-8859-1: ISO-8859-1 encoding
TableName String No Table_text

The destination table to which you want to import the data in the CSV format.

Note This parameter is required if you set the FileType parameter to CSV.
InsertType String No INSERT

The mode in which the data in the CSV format is to be written to the destination table. Valid values:

  • INSERT: The database checks the primary key when data is written. If a duplicate primary key value exists, an error message is returned.
  • INSERT_IGNORE: If the imported data contains data records that are the same as those in the destination table, the new data records are ignored.
  • REPLACE_INTO: If the imported data contains a row that has the same value for the primary key or unique index as one row in the destination table, the database deletes the existing row and inserts the new row into the destination table.
Note This parameter is required if you set the FileType parameter to CSV.
CsvFirstRowIsColumnDef Boolean No true

The type of the CSV file. Valid values:

  • true: The first row in the CSV file contains field names.
  • false: The first row in the CSV file contains data.
Note This parameter is required if you set the FileType parameter to CSV.
IgnoreError Boolean No false

Specifies whether to skip an error that occurs. Valid values:

  • true: skips the error and continues to execute SQL statements.
  • false: stops executing SQL statements.
ImportMode String No FAST_MODE

The import mode. Valid values:

  • FAST_MODE: In the Execute step, the uploaded file is read and SQL statements are executed to import data to the specified destination database. Compared with the security mode, this mode can be used to import data in a less secure but more efficient manner.
  • SAFE_MODE: In the Precheck step, the uploaded file is parsed, and SQL statements or CSV file data is cached. In the Execute step, the cached SQL statements are read and executed to import data, or the cached CSV file data is read and imported to the specified destination database. This mode can be used to import data in a more secure but less efficient manner.
RollbackSQL String No empty

The SQL statements used to roll back the data import.

Note This parameter is required if you set the RollbackSqlType parameter to TEXT.
RollbackAttachmentName String No rollback.sql

The key of the attachment that contains the SQL statements used to roll back the data import. You can call the GetUserUploadFileJob operation to obtain the attachment key from the value of the AttachmentKey parameter.

Note This parameter is required if you set the RollbackSqlType parameter to ATTACHMENT.
RollbackSqlType String No TEXT

The format of the SQL statements used to roll back the data import. Valid values:

  • TEXT: text
  • ATTACHMENT: attachment
AttachmentKey String No order_attachment.txt

The key of the attachment that provides more instructions for the ticket. You can call the GetUserUploadFileJob operation to obtain the attachment key from the value of the AttachmentKey parameter.

Tid Long No 3***

The ID of the tenant. You can call the GetUserActiveTenant or ListUserTenants operation to obtain the tenant ID.

RegionId String No cn-hangzhou

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

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. Valid values:

  • true: The request is successful.
  • false: The request fails.
ErrorMessage String UnknownError

The error message returned if the request fails.

ErrorCode String UnknownError

The error code returned if the request fails.

CreateOrderResult Array of Long 1****

The ID of the ticket.

Examples

Sample requests

http(s)://dms-enterprise.aliyuncs.com/?Action=test
&Comment=test
&RelatedUserList=[51****]
&Param={"Classify":"test","AttachmentName":"order_text","DbItemList":[{"DbId":1860****,"Logic":false}],"FileType":"CSV","FileEncoding":"AUTO","TableName":"Table_text","InsertType":"INSERT","CsvFirstRowIsColumnDef":true,"IgnoreError":false,"ImportMode":"FAST_MODE"}
&AttachmentKey=order_attachment.txt
&<Common request parameters>

Sample success responses

XML format

HTTP/1.1 200 OK
Content-Type:application/xml

<CreateDataImportOrderResponse>
    <RequestId>0C1CB646-1DE4-4AD0-B4A4-7D47DD52E931</RequestId>
    <Success>true</Success>
    <CreateOrderResult>1****</CreateOrderResult>
</CreateDataImportOrderResponse>

JSON format

HTTP/1.1 200 OK
Content-Type:application/json

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

Error codes

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