ListConnections

Updated at:

Queries a list of data sources.

Try it now

Try this API in OpenAPI Explorer, no manual signing needed. Successful calls auto-generate SDK code matching your parameters. Download it with built-in credential security for local usage.

Test

RAM authorization

No authorization for this operation. If you encounter issues with this operation, contact technical support.

Request parameters

Parameter

Type

Required

Description

Example

ProjectId

integer

Yes

The ID of the workspace to which the data source belongs. You can call the ListProjects operation to obtain the workspace ID.

76086

Name

string

No

The name of the data source to query.

abc

ConnectionType

string

No

The type of the connection string. Valid values:

  • odps

  • mysql

  • rds

  • oss

  • sqlserver

  • polardb

  • oracle

  • mongodb

  • emr

  • postgresql

  • analyticdb_for_mysql

  • hybriddb_for_postgresql

  • holo

rds

SubType

string

No

The subtype of the connection string. This parameter applies to scenarios where a parent type contains subtypes. Valid combinations:

  • Parent type: rds

  • Subtypes: mysql, sqlserver, or postgresql.

mysql

Status

string

No

The status of the data source. Valid values:

  • ENABLED: normal

  • DISABLED: disabled

ENABLED

EnvType

integer

No

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

  • 0: development environment

  • 1: production environment

1

PageSize

integer

No

The number of entries to return on each page. Default value: 10. Maximum value: 100.

10

PageNumber

integer

No

The page number for the paging query. Valid values: positive integers greater than or equal to 1.

1

Response elements

Element

Type

Description

Example

object

HttpStatusCode

integer

The HTTP status code.

200

RequestId

string

The request ID.

0bc14115159376359****

Success

boolean

Indicates whether the request is successful.

true

Data

object

The paging query results of connection strings.

PageNumber

integer

The page number.

1

PageSize

integer

The number of entries to return on each page. Default value: 10. Maximum value: 100.

20

TotalCount

integer

The total number of data sources.

3

Connections

array<object>

The list of connection strings.

object

Status

integer

The status of the data source. Valid values:

  • 1: normal

  • 2: disabled

1

ConnectionType

string

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

mysql

ProjectId

integer

The ID of the workspace associated with the data source.

123

SubType

string

The subtype of the data source. This parameter applies to scenarios where a parent type contains subtypes. Valid combinations:

  • Parent type: rds

  • Subtypes: mysql, sqlserver, or postgresql.

mysql

GmtModified

string

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

Mar 17, 2021 4:09:32 PM

EnvType

integer

The environment of the data source. Valid values:

  • 0: development environment

  • 1: production environment

1

ConnectStatus

integer

The connection status of the data source. Valid values:

  • 1: normal

  • 2: disabled

1

Sequence

integer

The sort field. Data sources are sorted in descending order based on this field.

300

Description

string

The description of the data source.

a connection

GmtCreate

string

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

Mar 17, 2021 4:09:32 PM

DefaultEngine

boolean

Indicates whether the engine associated with the data source is the default engine of the same type.

false

Shared

boolean

Indicates whether the data source is shared.

false

Operator

string

The ID of the Alibaba Cloud user who last modified the data source.

193543050****

Name

string

The name of the data source.

abc

Content

string

The detailed information of the data source. Examples of common data sources:

  • odps

{
  "accessId": "xssssss",
  "accessKey": "xsaxsaxsa",
  "authType": 2,
  "endpoint": "http://service.odps.aliyun.com/api",
  "project": "xsaxsax",
  "tag": "public"
}
  • mysql

{
  "database": "xsaxsa",
  "instanceName": "rm-xsaxsa",
  "password": "xsaxsa",
  "rdsOwnerId": "xasxsa",
  "regionId": "cn-shanghai",
  "tag": "rds",
  "username": "xsaxsa"
}
  • rds

{
  "configType": 1,
  "tag": "rds",
  "database": "xsaxsa",
  "username": "xsaxsa",
  "password": "xssaxsa$32050",
  "instanceName": "rm-xsaxs",
  "rdsOwnerId": "11111111"
}
  • oss

{
  "accessId": "sssssxx",
  "accessKey": "xsaxaxsaxs",
  "bucket": "xsa-xs-xs",
  "endpoint": "http://oss-cn-shanghai.aliyuncs.com",
  "tag": "public"
}
  • sqlserver

{
  "jdbcUrl": "jdbc:sqlserver://xsaxsa-xsaxsa.database.xxx.cn:123;DatabaseName=xsxs-xsxs",
  "password": "sdasda$fs",
  "tag": "public",
  "username": "sxaxacdacdd"
}
  • polardb

{
  "clusterId": "pc-sdadsadsa",
  "database": "dsadsadsa",
  "ownerId": "121212122",
  "password": "sdasdafssa",
  "region": "cn-shanghai",
  "tag": "polardb",
  "username": "asdadsads"
}
  • oracle

{
  "jdbcUrl": "jdbc:oracle:saaa:@xxxxx:1521:PROD",
  "password": "sxasaxsa",
  "tag": "public",
  "username": "sasfadfa"
}
  • mongodb

{
  "address": "[\"xsaxxsa.mongodb.rds.aliyuncs.com:3717\"]",
  "database": "admin",
  "password": "sadsda@",
  "tag": "public",
  "username": "dsadsadas"
}
  • emr

{
  "accessId": "xsaxsa",
  "emrClusterId": "C-dsads",
  "emrResourceQueueName": "default",
  "emrEndpoint": "emr.aliyuncs.com",
  "accessKey": "dsadsad",
  "emrUserId": "224833315798889783",
  "name": "sasdsadsa",
  "emrAccessMode": "simple",
  "region": "cn-shanghai",
  "authType": "2",
  "emrProjectId": "FP-sdadsad"
}
  • postgresql

{
  "jdbcUrl": "jdbc:postgresql://xxxx:1921/ssss",
  "password": "sdadsads",
  "tag": "public",
  "username": "sdsasda"
}
  • analyticdb_for_mysql

{
  "instanceId": "am-sadsada",
  "database": "xsxsx",
  "username": "xsxsa",
  "password": "asdadsa",
  "connectionString": "am-xssxsxs.ads.aliyuncs.com:3306"
}
  • hybriddb_for_postgresql

{
  "connectionString": "gp-xsaxsaxa-master.gpdbmaster.rds.aliyuncs.com",
  "database": "xsaxsaxas",
  "password": "xsaxsaxsa@11",
  "instanceId": "gp-xsaxsaxsa",
  "port": "541132",
  "ownerId": "xsaxsaxsas",
  "username": "sadsad"
}
  • holo

{
  "accessId": "xsaxsaxs",
  "accessKey": "xsaxsaxsa",
  "database": "xsaxsaxsa",
  "instanceId": "xsaxa",
  "tag": "aliyun"
}
  • kafka

{
  "instanceId": "xsax-cn-xsaxsa",
  "regionId": "cn-shanghai",
  "tag": "aliyun",
  "ownerId": "1212121212112"
}

{\"database\":\"xxx\",\"instanceName\":\"xxx\",\"password\":\"xxx\",\"rdsOwnerId\":\"xxx\",\"tag\":\"rds\",\"username\":\"xxx\"}

Id

integer

The ID of the data source.

1

BindingCalcEngineId

integer

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

123

TenantId

integer

The tenant ID.

1234567

Examples

Success response

JSON format

{
  "HttpStatusCode": 200,
  "RequestId": "0bc14115159376359****",
  "Success": true,
  "Data": {
    "PageNumber": 1,
    "PageSize": 20,
    "TotalCount": 3,
    "Connections": [
      {
        "Status": 1,
        "ConnectionType": "mysql",
        "ProjectId": 123,
        "SubType": "mysql",
        "GmtModified": "Mar 17, 2021 4:09:32 PM",
        "EnvType": 1,
        "ConnectStatus": 1,
        "Sequence": 300,
        "Description": "a connection",
        "GmtCreate": "Mar 17, 2021 4:09:32 PM",
        "DefaultEngine": false,
        "Shared": false,
        "Operator": "193543050****",
        "Name": "abc",
        "Content": "{\\\"database\\\":\\\"xxx\\\",\\\"instanceName\\\":\\\"xxx\\\",\\\"password\\\":\\\"xxx\\\",\\\"rdsOwnerId\\\":\\\"xxx\\\",\\\"tag\\\":\\\"rds\\\",\\\"username\\\":\\\"xxx\\\"}",
        "Id": 1,
        "BindingCalcEngineId": 123,
        "TenantId": 1234567
      }
    ]
  }
}

Error codes

HTTP status code

Error code

Error message

Description

400 Invalid.Tenant.ConnectionNotExists The connection does not exist. The connection does not exist.
400 Invalid.Tenant.ProjectNotExists The project does not exist. The project does not exist.
400 Invalid.Tenant.UserNotInProject The user is not in the project. The user is not in the project.
403 Invalid.Tenant.UserIsNotProjectOwnerOrAdmin The user is not a project administrator or owner. The user is not a project administrator or owner.
403 Invalid.Tenant.UserNotInTenant The user is not in tenant. The user is not in tenant.

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.