All Products
Search
Document Center

:CreateDISyncTask

最終更新日:Mar 13, 2024

Creates a data synchronization task.

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

CreateDISyncTask

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

ProjectId

Long

Yes

10000

The DataWorks workspace ID. You can log on to the DataWorks console and go to the Workspace page to obtain the workspace ID.

TaskType

String

Yes

DI_OFFLINE

The type of the data synchronization task.

Valid values: DI_OFFLINE, DI_REALTIME, and DI_SOLUTION.

TaskContent

String

Yes

{"type":"job","version":"2.0","steps":[{"stepType":"mysql","parameter":{"envType":1,"datasource":"mysql_pub","column":["id","name","create_time","age","score","t_01"],"connection":[{"datasource":"mysql_pub","table":["u_pk"]}],"where":"","splitPk":"id","encoding":"UTF-8"},"name":"Reader","category":"reader"},{"stepType":"odps","parameter":{"partition":"pt=${bizdate}","truncate":true,"datasource":"odps_source","envType":1,"column":["id","name","create_time","age","score","t_01"],"emptyAsNull":false,"tableComment":"null","table":"u_pk"},"name":"Writer","category":"writer"}],"setting":{"executeMode":null,"errorLimit":{"record":""},"speed":{"concurrent":2,"throttle":false}},"order":{"hops":[{"from":"Reader","to":"Writer"}]}}

The configurations of the batch synchronization task to be created. Calling this API operation to create a batch synchronization task is equivalent to creating a batch synchronization task by using the code editor in the DataWorks console. For more information, see Create a data synchronization task by using the code editor.

TaskParam

String

Yes

{"FileFolderPath":"Business Flow/XXX/Data Integration","ResourceGroup":"S_res_group_XXX_XXXX"}

The settings that specify the storage path of the data synchronization task and the resource group used by the task. The following parameters are supported:

  • FileFolderPath: the storage path of the data synchronization task.

  • ResourceGroup: the identifier of the resource group for Data Integration that is used by the data synchronization task. You can call the ListResourceGroups operation to query the identifier of the resource group.

TaskName

String

Yes

new_di_task

The name of the data synchronization task.

ClientToken

String

No

0000-ABCD-EFG****

The client token that is used to ensure the idempotence of the request. This parameter can be left empty.

Response parameters

Parameter

Type

Example

Description

Success

Boolean

true

Indicates whether the request was successful. Valid values: true and false.

RequestId

String

0bc1411515937635973****

The request ID. You can use the ID to locate logs and troubleshoot issues.

Data

Object

The information that indicates whether the data synchronization task is created.

Status

String

success

The creation status of the data synchronization task. Valid values:

  • success

  • fail

Message

String

Invalid path: Business Flow/xxxx/Data Integration

The error message that is returned if the data synchronization task fails to be created. If the data synchronization task is successfully created, this parameter is not returned. If the data synchronization task fails to be created, an error message in the "Invalid path: Business Flow/xxxx/Data Integration" format is returned.

FileId

Long

1000001

The ID of the data synchronization task that is created.

Examples

Sample requests

http(s)://[Endpoint]/?Action=CreateDISyncTask
&ProjectId=10000
&TaskType=DI_OFFLINE
&TaskContent={"type":"job","version":"2.0","steps":[{"stepType":"mysql","parameter":{"envType":1,"datasource":"mysql_pub","column":["id","name","create_time","age","score","t_01"],"connection":[{"datasource":"mysql_pub","table":["u_pk"]}],"where":"","splitPk":"id","encoding":"UTF-8"},"name":"Reader","category":"reader"},{"stepType":"odps","parameter":{"partition":"pt=${bizdate}","truncate":true,"datasource":"odps_source","envType":1,"column":["id","name","create_time","age","score","t_01"],"emptyAsNull":false,"tableComment":"null","table":"u_pk"},"name":"Writer","category":"writer"}],"setting":{"executeMode":null,"errorLimit":{"record":""},"speed":{"concurrent":2,"throttle":false}},"order":{"hops":[{"from":"Reader","to":"Writer"}]}}
&TaskParam={"FileFolderPath":"Business Flow/XXX/Data Integration","ResourceGroup":"S_res_group_XXX_XXXX"}
&TaskName=new_di_task
&ClientToken=0000-ABCD-EFG****
&<Common request parameters>

Sample success responses

XML format

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

<CreateDISyncTaskResponse>
    <Success>true</Success>
    <RequestId>0bc1411515937635973****</RequestId>
    <Data>
        <Status>success</Status>
        <FileId>1000001</FileId>
    </Data>
</CreateDISyncTaskResponse>

JSON format

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

{
  "Success" : true,
  "RequestId" : "0bc1411515937635973****",
  "Data" : {
    "Status" : "success",
    "FileId" : 1000001
  }
}

Error codes

HTTP status code

Error code

Error message

Description

400

Invalid.DI.Parameter

The parameter is invalid.

One or more parameters are invalid.

400

Invalid.DI.Parameter.File.Existed

The file name already exists.

The specified file name already exists.

403

Forbidden.DI.NoPrivilege

No access.

You do not have the required permissions.

500

InternalError.DI.Parameter

A DI internal error occurred.

An internal error has occurred in Data Integration.

For a list of error codes, see Service error codes.