Updated on 2023-10-24 GMT+08:00

Importing Tasks in Batches

Function

This API is used to import the task template to create tasks in batches.

Constraints

This API supports only MySQL migration and synchronization tasks.

URI

POST /v5/{project_id}/jobs/template

Table 1 Path parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Project ID of a tenant in a region.

For details about how to obtain the project ID, see Obtaining a Project ID.

Request Parameters

Table 2 Request header parameters

Parameter

Mandatory

Type

Description

Content-Type

Yes

String

MIME type of the request body. Use the default value multipart/form-data. For APIs used to upload objects or images, the value varies depending on the flow type.

Default value: multipart/form-data

X-Auth-Token

Yes

String

User token obtained from IAM.

It is a response to the API for obtaining a user token. This API is the only one that does not require authentication.

After a request is processed, the value of X-Subject-Token in the header is the token value.

X-Language

No

String

Request language type.

Default value: en-us

Enumerated values:

  • en-us
  • zh-cn
Table 3 FormData parameter

Parameter

Mandatory

Type

Description

file

Yes

File

Template file to be uploaded.

Response Parameters

Status code: 200

Table 4 Response body parameters

Parameter

Type

Description

async_job_id

String

ID of the tasks created in batches by importing a template.

import_error_messages

Array of objects

Error message displayed for an import failure.

For details, see Table 5.

error_code

String

Error code.

Minimum length: 12

Maximum length: 12

error_msg

String

Error message.

Minimum length: 1

Maximum length: 512

Table 5 Data structure description of field import_error_messages

Parameter

Type

Description

sheet_name

String

Sheet name.

row_rum

String

Error row number.

value

String

Value in the value column of the error row.

error_message

String

Error message.

Example Request

Importing the task template to create tasks in batches

https://{endpoint}/v5/054ba152d480d55b2f5dc0069e7ddef0/jobs/template

Example Response

Status code: 200

OK

{
   "async_job_id":"dc6016cf-f3b6-4c2d-b4d7-5084b0fdf456"
}

Status code: 400

Bad Request
{
   "error_code":"DRS.10120001",
   "error_msg": "Failed to parse the imported file"
   "import_error_messages":[
      {
         "sheet_name":"sheet0",
         "row_rum":"10",
         "value":"test",
         "error_message":"base_info.tags parse object failed."
      }
   ]
}

Status Code

Status Code

Description

200

OK

400

Bad Request

Error Code

For details, see Error Code.