Imports data sources from your on-premises device to a specified DataWorks workspace.

You can import self-managed data sources or data sources that are exported from other Dataworks workspaces to a specified DataWorks workspace.

  • To import a self-managed data source to DataWorks, the data source type must be supported by DataWorks. For more information about the types of data sources supported by DataWorks, see Supported data stores.
  • For more information about how to export data sources from DataWorks workspaces to on-premises devices, see ExportDataSources.

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 ImportDataSources

The operation that you want to perform.

DataSources String Yes [{"SubType":"","DataSourceType":"mysql","EnvType":1,"Name":"mysql_dms2","Description":"aaa","Content":"{\"database\":\"mysql_chengdu_old\",\"password\":\"***\",\"instanceName\":\"rm-2vcrckb37163g7l3w\",\"regionId\":\"cn-chengdu\",\"tag\":\"rds\",\"rdsOwnerId\":\"333\",\"username\":\"mysql_chengdu2\"}"},{"SubType":"","DataSourceType":"mysql","EnvType":1,"Name":"mysql_dms2","Description":"aaa","Content":"{\"database\":\"mysql_chengdu_old\",\"password\":\"***\",\"instanceName\":\"rm-2vcrckb37163g7l3w\",\"regionId\":\"cn-chengdu\",\"tag\":\"rds\",\"rdsOwnerId\":\"143\",\"username\":\"mysql_chengdu2\"}"}]

The configurations of the data sources to be imported. The Name, DataSourceType, SubType, Description, Content, and EnvType fields are required. For more information about the fields, see CreateDataSource.

ProjectId Long Yes 10000

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

RegionId String Yes cn-shanghai

The ID of the region in which the DataWorks workspace resides. For example, the ID of the China (Shanghai) region is cn-shanghai, and that of the China (Zhangjiakou) region is cn-zhangjiakou. The system automatically determines the value of this parameter based on the endpoint used to call the operation.

Response parameters

Parameter Type Example Description
Data Struct

The information about the import operation.

Message String Data source DEV XXX already exists

The reason why the data sources failed to be imported. If the data sources were imported, this parameter is left empty.

Status Boolean true

Indicates whether the data sources were imported. Valid values:

  • true: All the data sources were imported.
  • false: Some of the data sources failed to be imported. You can troubleshoot issues based on the Message parameter.
RequestId String 0bc1411515937635973****

The ID of the request. You can locate logs and troubleshoot issues based on the ID.

Success Boolean true

Indicates whether the request was successful. Valid values:

  • true: The request was successful.
  • false: The request failed.

Examples

Sample requests

http(s)://[Endpoint]/?Action=ImportDataSources
&DataSources=[{"SubType":"","DataSourceType":"mysql","EnvType":1,"Name":"mysql_dms2","Description":"aaa","Content":"{\"database\":\"mysql_chengdu_old\",\"password\":\"***\",\"instanceName\":\"rm-2vcrckb37163g7l3w\",\"regionId\":\"cn-chengdu\",\"tag\":\"rds\",\"rdsOwnerId\":\"333\",\"username\":\"mysql_chengdu2\"}"},{"SubType":"","DataSourceType":"mysql","EnvType":1,"Name":"mysql_dms2","Description":"aaa","Content":"{\"database\":\"mysql_chengdu_old\",\"password\":\"***\",\"instanceName\":\"rm-2vcrckb37163g7l3w\",\"regionId\":\"cn-chengdu\",\"tag\":\"rds\",\"rdsOwnerId\":\"143\",\"username\":\"mysql_chengdu2\"}"}]
&ProjectId=10000
&RegionId=cn-shanghai
&<Common request parameters>

Sample success responses

XML format

<RequestId>0bc1411515937635973****</RequestId>
<Data>
    <Status>true</Status>
    <Message> Data source DEV XXX already exists</Message>
</Data>
<Success>true</Success>

JSON format

{
    "RequestId": "0bc1411515937635973****",
    "Data": {
        "Status": true,
        "Message": "Data source DEV XXX already exists"
    },
    "Success": true
}

Error codes

Http status code Error code Error message Description
403 Forbidden.DI.NoPrivilege No access. The error message returned because you do not have the required permissions.
500 InternalError.DI.Parameter A DI internal error occurred. The error message returned because an internal error in Data Integration occurred.
400 Invalid.DI.Parameter The parameter is invalid. The error code returned because one or more parameters are invalid.

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