Queries the metadata of a specified data source.

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 GetDataSourceMeta

The operation that you want to perform.

DatasourceName String Yes mysql_name

The name of the data source.

PageNumber Long Yes 1

The number of the page to return.

PageSize Long Yes 10

The number of entries to return on each page.

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 data source 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.

EnvType String No 1

The environment to which the data source belongs. Valid values:

  • 0: development environment
  • 1: production environment

Response parameters

Parameter Type Example Description
Data Struct

The information about the query operation.

Message String read datasource time out

The reason why the metadata of the data source failed to be retrieved. If the metadata of the data source was retrieved, this parameter is left empty.

Meta String {"dbTables":[{"dbName":"testdb","schema":[{"tableInfos":[{"dbName":"testdb","enable":true,"table":"table1","tableName":"table1"}]},{"tableInfos":[{"dbName":"testdb","enable":true,"table":"table2","tableName":"table2"}]}]}]}

The returned metadata of the data source. The returned metadata is in the JSON format.

{"dbTables":[{"dbName":"testdb","schema":[{"tableInfos":[{"dbName":"testdb","enable":true,"table":"table1","tableName":"table1"}]},{"tableInfos":[{"dbName":"testdb","enable":true,"table":"table2","tableName":"table2"}]}]}]}

Field description:

  • dbName: the name of the database in which the data source resides.
  • schema: the schema of the database.
  • enable: indicates whether the database is available. The value true indicates that the database is available. The value false indicates that the database is unavailable.
  • tableName: the name of the table in the database.
  • tableInfos: the information about the table in the database.
Status String success

Indicates whether the metadata of the data source was retrieved. Valid values:

  • success: the metadata of the data source was retrieved.
  • fail: the metadata of the data source failed to be retrieved. You can troubleshoot issues based on the Message parameter.
RequestId String 0000-ABCD-EFG

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=GetDataSourceMeta
&DatasourceName=mysql_name
&PageNumber=1
&PageSize=10
&ProjectId=10000
&RegionId=cn-shanghai
&<Common request parameters>

Sample success responses

XML format

<RequestId>0000-ABCD-EFG    </RequestId>
<Data>
    <Status>success</Status>
    <Meta>{"dbTables":[{"dbName":"testdb","schema":[{"tableInfos":[{"dbName":"testdb","enable":true,"table":"table1","tableName":"table1"}]},{"tableInfos":[{"dbName":"testdb","enable":true,"table":"table2","tableName":"table2"}]}]}]}</Meta>
    <Message>read datasource time out</Message>
</Data>
<Success>true</Success>

JSON format

{
    "RequestId": "0000-ABCD-EFG",
    "Data": {
        "Status": "success",
        "Meta": "{\"dbTables\":[{\"dbName\":\"testdb\",\"schema\":[{\"tableInfos\":[{\"dbName\":\"testdb\",\"enable\":true,\"table\":\"table1\",\"tableName\":\"table1\"}]},{\"tableInfos\":[{\"dbName\":\"testdb\",\"enable\":true,\"table\":\"table2\",\"tableName\":\"table2\"}]}]}]}",
        "Message": "read datasource time out"
    },
    "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.