All Products
Search
Document Center

DataWorks:ListDataSources

Last Updated:Nov 21, 2024

Queries the data sources added to a DataWorks workspace.

Debugging

You can run this interface directly in OpenAPI Explorer, saving you the trouble of calculating signatures. After running successfully, OpenAPI Explorer can automatically generate SDK code samples.

Authorization information

The following table shows the authorization information corresponding to the API. The authorization information can be used in the Action policy element to grant a RAM user or RAM role the permissions to call this API operation. Description:

  • Operation: the value that you can use in the Action element to specify the operation on a resource.
  • Access level: the access level of each operation. The levels are read, write, and list.
  • Resource type: the type of the resource on which you can authorize the RAM user or the RAM role to perform the operation. Take note of the following items:
    • The required resource types are displayed in bold characters.
    • If the permissions cannot be granted at the resource level, All Resources is used in the Resource type column of the operation.
  • Condition Key: the condition key that is defined by the cloud service.
  • Associated operation: other operations that the RAM user or the RAM role must have permissions to perform to complete the operation. To complete the operation, the RAM user or the RAM role must have the permissions to perform the associated operations.
OperationAccess levelResource typeCondition keyAssociated operation
dataworks:*list
*All Resources
*
    none
none

Request parameters

ParameterTypeRequiredDescriptionExample
ProjectIdlongYes

The ID of the DataWorks workspace to which the data sources belong. You can call the ListProjects operation to query the ID.

1
NamestringNo

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

test
DataSourceTypestringNo

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
rds
SubTypestringNo

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

If the value of the DataSourceType parameter is rds, the value of this parameter can be mysql, sqlserver, or postgresql.

mysql
StatusstringNo

The status of the data source. Valid values:

  • ENABLED
  • DISABLED
ENABLED
EnvTypeintegerNo

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

1
PageSizeintegerNo

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

10
PageNumberintegerNo

The page number. Pages start from page 1.

1

Response parameters

ParameterTypeDescriptionExample
object

The response parameters.

HttpStatusCodeinteger

The HTTP status code.

200
RequestIdstring

The request ID.

0bc14115159376359****
Successboolean

Indicates whether the request was successful.

true
Dataobject

The query result returned.

PageNumberinteger

The page number.

1
PageSizeinteger

The number of entries per page.

20
TotalCountinteger

The total number of data sources.

233
DataSourcesarray<object>

The data sources.

DataSourcesobject
Statusinteger

The status of the data source. Valid values:

  • 1: The data source is accessible.
  • 2: The data source is inaccessible.
1
ProjectIdinteger

The ID of the workspace to which the data source belongs.

123
SubTypestring

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

mysql
GmtModifiedstring

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

Mar 17, 2021 4:09:32 PM
EnvTypeinteger

The environment in which the data source is used. Valid values:

  • 0: development environment
  • 1: production environment
1
ConnectStatusinteger

The status of the data source. Valid values:

  • 1: The data source is accessible.
  • 2: The data source is inaccessible.
1
Sequenceinteger

The sequence number of the data source. Data sources are sorted in descending order based on the value of this parameter.

300
Descriptionstring

The description of the data source.

a connection
DataSourceTypestring

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
rds
GmtCreatestring

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

Mar 17, 2021 4:09:32 PM
DefaultEngineboolean

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

false
Sharedboolean

Indicates whether the data source is a shared data source.

false
Operatorstring

The ID of the Alibaba Cloud account that is used to last modify the data source.

193543050****
Namestring

The name of the data source.

abc
Contentstring

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

  • MaxCompute

    {
      "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

    {
      "configType": "1",
      "database": "mysql_d111b",
      "instanceName": "rm-xxxxxx",
      "password": "***",
      "rdsOwnerId": "12133xxxxxx",
      "tag": "rds",
      "username": "mysql_db111"
    }
    
  • ApsaraDB RDS for SQL Server

    {
      "configType": "1",
      "jdbcUrl": "jdbc:sqlserver://rm-xxxxx.sqlserver.rds.aliyuncs.com:1433;DatabaseName=sqlserver_db1",
      "password": "***",
      "tag": "public",
      "username": "sqlserver_db111"
    }
    
  • Object Storage Service (OSS)

    {
      "accessId": "LTAINbR9Uxxxx",
      "accessKey": "***",
      "bucket": "bigxxx1223",
      "configType": "1",
      "endpoint": "http://oss-cn-hangzhou.aliyuncs.com",
      "tag": "public"
    }
    
  • ApsaraDB RDS for PostgreSQL

    {
      "configType": "1",
      "database": "cdp_xxx",
      "instanceName": "rm-xxxx",
      "password": "***",
      "rdsOwnerId": "121xxxxx",
      "tag": "rds",
      "username": "cdp_xxx"
    }
    
  • AnalyticDB for MySQL

    {
      "configType": "1",
      "password": "***",
      "schema": "ads_demo",
      "tag": "public",
      "url": "ads-xxx-xxxx.cn-hangzhou-1.ads.aliyuncs.com:3029",
      "username": "lslslsls"
    }
    
{"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"}
Idinteger

The data source ID.

1
BindingCalcEngineIdinteger

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

123
TenantIdlong

The tenant ID.

1234567

Examples

Sample success responses

JSONformat

{
  "HttpStatusCode": 200,
  "RequestId": "0bc14115159376359****",
  "Success": true,
  "Data": {
    "PageNumber": 1,
    "PageSize": 20,
    "TotalCount": 233,
    "DataSources": [
      {
        "Status": 1,
        "ProjectId": 123,
        "SubType": "mysql",
        "GmtModified": "Mar 17, 2021 4:09:32 PM",
        "EnvType": 1,
        "ConnectStatus": 1,
        "Sequence": 300,
        "Description": "a connection",
        "DataSourceType": "rds",
        "GmtCreate": "Mar 17, 2021 4:09:32 PM",
        "DefaultEngine": false,
        "Shared": false,
        "Operator": "193543050****",
        "Name": "abc",
        "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\"}",
        "Id": 1,
        "BindingCalcEngineId": 123,
        "TenantId": 1234567
      }
    ]
  }
}

Error codes

HTTP status codeError codeError messageDescription
400Invalid.Tenant.ConnectionNotExistsThe connection does not exist.The connection does not exist.
400Invalid.Tenant.ProjectNotExistsThe project does not exist.The project does not exist.
400Invalid.Tenant.UserNotInProjectThe user is not in the project.The user is not in the project.
403Invalid.Tenant.UserIsNotProjectOwnerOrAdminThe user is not a project administrator or owner.The user is not a project administrator or owner.
403Invalid.Tenant.UserNotInTenantThe user is not in tenant.The user is not in tenant.

For a list of error codes, visit the Service error codes.

Change history

Change timeSummary of changesOperation
2023-06-05The Error code has changed. The response structure of the API has changedView Change Details
2022-07-12API Description Update. The Error code has changedView Change Details