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. Set the value to GetDataSourceMeta.

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.

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.

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 that is 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
Success Boolean true

Indicates whether the request was successful. Valid values:

  • true: The request was successful.
  • false: The request failed.
RequestId String 0000-ABCD-EFG

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

Data Object

The information about the query operation.

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.
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 null

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"}]}]}]}

Parameter 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. A value of true indicates that the database is available. A value of 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.

Examples

Sample requests

http(s)://[Endpoint]/?Action=GetDataSourceMeta
&ProjectId=10000
&DatasourceName=mysql_name
&PageNumber=1
&PageSize=10
&EnvType=1
&<Common request parameters>

Sample success responses

XML format

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

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

JSON format

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

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

Error codes

HTTP status code Error code Error message Description
400 Invalid.DI.Parameter The parameter is invalid. The error message returned because one or more parameters are invalid.
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 has occurred in Data Integration.

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