Queries the data sources of DataWorks.

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 ListDataSources

The operation that you want to perform.

Name String Yes test

The name of the data source that you want to query.

ProjectId Long Yes 1

The ID of the DataWorks workspace where the data source resides. You can call the ListProjects operation to obtain the ID.

RegionId String Yes cn-shanghai

The region ID of the data source. 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.

DataSourceType String No rds

The type of the data source. Valid values:

  • odps
  • mysql
  • rds
  • oss
  • sqlserver
  • polardb
  • oracle
  • mongodb
  • emr
  • postgresql
  • analyticdb_for_mysql
  • hybriddb_for_postgresql
  • holo
SubType String No mysql

The subtype of the data source. This parameter takes effect only when the DataSourceType parameter is set to rds.

If the DataSourceType parameter is set to rds, the parameter can be set to mysql, sqlserver, or postgresql.

Status String No ENABLED

The status of the data source. Valid values:

  • ENABLED: The data source is accessible.
  • DISABLED: The data source is inaccessible.
EnvType Integer No 1

The environment in which the data source runs. Valid values: 0 and 1. The value 0 indicates the development environment. The value 1 indicates the production environment.

PageSize Integer No 10

The number of the page to return. Default value: 10. Maximum value: 100.

PageNumber Integer No 1

The number of entries to return on each page. The value of this parameter must be a positive integer greater than or equal to 1.

Response parameters

Parameter Type Example Description
Data Struct

The query result returned.

DataSources Array of DataSources

The data sources.

BindingCalcEngineId Integer 123

The ID of the compute engine with which the data source is associated.

ConnectStatus Integer 1

The status of the data source. Valid values:

  • 1: The data source is accessible.
  • 2: The data source is inaccessible.
Content String {"pubEndpoint":"http://service.cn.maxcompute.aliyun.com/api","accessId":"TMP.3KecGjvzy3i8MYfn2BGHgF7EHGyBFZcHm7GgngrABVRyvvKQrfF5kskR36xP361C3dqwbGo7SGYptAeGyiTwHXqLaBUvYC","securityToken":null,"endpoint":"http://service.cn.maxcompute.aliyun-inc.com/api","accessKey":"***","name":"PRE_PROJECT_A_engine","project":"PRE_PROJECT_A","vpcEndpoint":"http://service.cn.maxcompute.aliyun-inc.com/api","region":"cn-shanghai","authType":"2"}

The data connection string. The value of this parameter is in the JSON format. Sample connection strings of common data sources:

  • MaxCompute
json
{
  "pubEndpoint": "http://service.cn.maxcompute.aliyun.com/api",
  "accessId": "xxxxxxx",
  "securityToken": null,
  "endpoint": "http://service.cn.maxcompute.aliyun-inc.com/api",
  "accessKey": "***",
  "name": "PRE_PROJECT_A_engine",
  "project": "PRE_PROJECT_A",
  "vpcEndpoint": "http://service.cn.maxcompute.aliyun-inc.com/api",
  "region": "cn-shanghai",
  "authType": "2"
}
                                
  • mysql
json
{
  "configType": "1",
  "database": "mysql_d111b",
  "instanceName": "rm-xxxxxx",
  "password": "***",
  "rdsOwnerId": "12133xxxxxx",
  "tag": "rds",
  "username": "mysql_db111"
}
                                
  • sqlserver
json
{
  "configType": "1",
  "jdbcUrl": "jdbc:sqlserver://rm-xxxxx.sqlserver.rds.aliyuncs.com:1433;DatabaseName=sqlserver_db1",
  "password": "***",
  "tag": "public",
  "username": "sqlserver_db111"
}
                                
  • oss
json
{
  "accessId": "LTAINbR9Uxxxx",
  "accessKey": "***",
  "bucket": "bigxxx1223",
  "configType": "1",
  "endpoint": "http://oss-cn-hangzhou.aliyuncs.com",
  "tag": "public"
}
                                
  • postgresql
json
{
  "configType": "1",
  "database": "cdp_xxx",
  "instanceName": "rm-xxxx",
  "password": "***",
  "rdsOwnerId": "121xxxxx",
  "tag": "rds",
  "username": "cdp_xxx"
}
                                
  • Redis
json
{
  "address": "[{\"host\":\"r-xxxx.redis.rds.aliyuncs.com\",\"port\":6379}]",
  "aliyunKp": "12xxxx",
  "password": "***",
  "tag": "public"
}
                                
  • ads
json
{
  "configType": "1",
  "password": "***",
  "schema": "ads_demo",
  "tag": "public",
  "url": "ads-xxx-xxxx.cn-hangzhou-1.ads.aliyuncs.com:3029",
  "username": "lslslsls"
}
                                
DataSourceType String rds

The type of the data source. Valid values:

  • odps
  • mysql
  • rds
  • oss
  • sqlserver
  • polardb
  • oracle
  • mongodb
  • emr
  • postgresql
  • analyticdb_for_mysql
  • hybriddb_for_postgresql
  • holo
DefaultEngine Boolean false

Indicates whether the engine that is associated with the data source is the default engine used by data sources of the same type.

Description String a connection

The description of the data source.

EnvType Integer 1

The environment in which the data source runs. Valid values:

  • 0: development environment.
  • 1: production environment.
GmtCreate String Mar 17, 2021 4:09:32 PM

The time when the data source was created. Example: Mar 17, 2021 4:09:32 PM.

GmtModified String Mar 17, 2021 4:09:32 PM

The time when the data source was last modified. Example: Mar 17, 2021 4:09:32 PM.

Id Integer 1

The ID of the data source.

Name String abc

The name of the data source.

Operator String 193543050****

The ID of the Alibaba Cloud account that last modifies the data source.

ProjectId Integer 123

The ID of the workspace with which the data source is associated.

Sequence Integer 300

The sequence number of the data source. This parameter is used to sort data sources in descending order.

Shared Boolean false

Indicates whether the data source is shared.

Status Integer 1

The status of the data source. Valid values:

  • 1: The data source is accessible.
  • 2: The data source is inaccessible.
SubType String mysql

The subtype of the data source. This parameter takes effect only when the DataSourceType parameter is set to rds.

If the DataSourceType parameter is set to rds, the parameter can be set to mysql, sqlserver, or postgresql.

TenantId Long 1234567

The ID of the tenant.

PageNumber Integer 1

The page number of the returned page.

PageSize Integer 20

The number of entries returned per page. Default value: 10. Maximum value: 100.

TotalCount Integer 233

The total number of data sources.

HttpStatusCode Integer 200

The HTTP status code returned.

RequestId String 0bc14115159376359****

The ID of the request.

Success Boolean true

Indicates whether the request was successful.

Examples

Sample requests

http(s)://[Endpoint]/?Action=ListDataSources
&Name=test
&ProjectId=1
&RegionId=cn-shanghai
&<Common request parameters>

Sample success response

XML format

<RequestId>0bc14115159376359****</RequestId>
<HttpStatusCode>200</HttpStatusCode>
<Data>
    <TotalCount>233</TotalCount>
    <PageSize>20</PageSize>
    <PageNumber>1</PageNumber>
    <DataSources>
        <Status>1</Status>
        <Operator>193543050****</Operator>
        <ConnectStatus>1</ConnectStatus>
        <SubType>mysql</SubType>
        <Description>a connection</Description>
        <BindingCalcEngineId>123</BindingCalcEngineId>
        <ProjectId>123</ProjectId>
        <GmtModified>Mar 17, 2021 4:09:32 PM</GmtModified>
        <Sequence>300</Sequence>
        <Shared>false</Shared>
        <EnvType>1</EnvType>
        <Name>abc</Name>
        <DefaultEngine>false</DefaultEngine>
        <TenantId>1234567</TenantId>
        <GmtCreate>Mar 17, 2021 4:09:32 PM</GmtCreate>
        <Content>{"pubEndpoint":"http://service.cn.maxcompute.aliyun.com/api","accessId":"TMP.3KecGjvzy3i8MYfn2BGHgF7EHGyBFZcHm7GgngrABVRyvvKQrfF5kskR36xP361C3dqwbGo7SGYptAeGyiTwHXqLaBUvYC","securityToken":null,"endpoint":"http://service.cn.maxcompute.aliyun-inc.com/api","accessKey":"***","name":"PRE_PROJECT_A_engine","project":"PRE_PROJECT_A","vpcEndpoint":"http://service.cn.maxcompute.aliyun-inc.com/api","region":"cn-shanghai","authType":"2"}</Content>
        <DataSourceType>rds</DataSourceType>
        <Id>1</Id>
    </DataSources>
</Data>
<Success>true</Success>

JSON format

{
    "RequestId": "0bc14115159376359****",
    "HttpStatusCode": 200,
    "Data": {
        "TotalCount": 233,
        "PageSize": 20,
        "PageNumber": 1,
        "DataSources": {
            "Status": 1,
            "Operator": "193543050****",
            "ConnectStatus": 1,
            "SubType": "mysql",
            "Description": "a connection",
            "BindingCalcEngineId": 123,
            "ProjectId": 123,
            "GmtModified": "Mar 17, 2021 4:09:32 PM",
            "Sequence": 300,
            "Shared": false,
            "EnvType": 1,
            "Name": "abc",
            "DefaultEngine": false,
            "TenantId": 1234567,
            "GmtCreate": "Mar 17, 2021 4:09:32 PM",
            "Content": "{\"pubEndpoint\":\"http://service.cn.maxcompute.aliyun.com/api\",\"accessId\":\"TMP.3KecGjvzy3i8MYfn2BGHgF7EHGyBFZcHm7GgngrABVRyvvKQrfF5kskR36xP361C3dqwbGo7SGYptAeGyiTwHXqLaBUvYC\",\"securityToken\":null,\"endpoint\":\"http://service.cn.maxcompute.aliyun-inc.com/api\",\"accessKey\":\"***\",\"name\":\"PRE_PROJECT_A_engine\",\"project\":\"PRE_PROJECT_A\",\"vpcEndpoint\":\"http://service.cn.maxcompute.aliyun-inc.com/api\",\"region\":\"cn-shanghai\",\"authType\":\"2\"}",
            "DataSourceType": "rds",
            "Id": 1
        }
    },
    "Success": true
}

Error codes

HTTP status code Error code Error message Description
400 Invalid.Tenant.ConnectionNotExists The connection does not exist. The error message returned because the specified data source does not exist.
400 Invalid.Tenant.ProjectNotExists The project does not exist. The error message returned because the specified project does not exist.
403 Invalid.Tenant.UserIsNotProjectOwnerOrAdmin The user is not a project administrator or owner. The error message returned because the user is not the project owner or project administrator.
400 Invalid.Tenant.UserNotInProject The user is not in the project. The error message returned because the user is not added to the project.
403 Invalid.Tenant.UserNotInTenant The user is not in tenant. The error message returned because the user does not belong to the tenant.

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