All Products
Search
Document Center

:GetDataSourceMeta

更新時間:May 17, 2024

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 DataWorks workspace ID. You can log on to the DataWorks console and go to the Workspace page to obtain the ID.

DatasourceName

String

Yes

mysql_name

The name of the data source.

PageNumber

Long

Yes

1

The page number.

PageSize

Long

Yes

10

The number of entries per page.

EnvType

String

No

1

The environment in which the data source resides. 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

  • false

RequestId

String

0000-ABCD-EFG

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

Data

Object

The returned result.

Status

String

success

Indicates whether the metadata of the data source is obtained. Valid values:

  • success: The metadata of the data source is obtained.

  • fail: The metadata of the data source fails to be obtained. You can troubleshoot issues based on the Message parameter.

Message

String

read datasource time out

The reason why the metadata of the data source fails to be obtained. If the metadata of the data source is obtained, no value is returned for this parameter.

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

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. The valid values are true and false. 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.

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\t",
  "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.

One or more parameters are invalid.

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.