Retrieve Data Source List
Use this API to query the data source list with pagination. Filter by data source ID, data source name, keyword, or data source type.
Request URL: /openapi/v1/datasource/list
Request Method: GET
Request Parameters
| Parameter | Type | Required | Description | Example |
|---|---|---|---|---|
| datasourceId | String | No | Data source ID. | ds-d92lj22cb03k |
| datasourceType | String | No | Data source type. All DatasourceType values currently defined by NineData are supported. Values are case-insensitive. | MYSQL |
| name | String | No | Data source name. | Production Environment MySQL |
| keyword | String | No | Keyword used for fuzzy search by data source information. | mongo |
| current | Integer | No | Current page number, starting from 1, default is 1. | 1 |
| pageSize | Integer | No | Page size, default is 10. | 50 |
Response Parameters
| Parameter | Type | Description | Example |
|---|---|---|---|
| success | Bool | Whether the interface call is successful. Return values: true, false. | true |
| requestId | String | Request ID. | Mi6y0FCN-BHEEaHAnCFFp9DFdAAk0OUZ |
| data | Array | Data source detail array. Each object contains common fields and may include sslConfig, multiTag, or data-source-specific fields depending on the data source type. | { "datasourceId": "ds-d92mr1g445le", "name": "127.0.0.1", "datasourceType": "MySQL" } |
| current | Integer | Current page number. | 1 |
| pageSize | Integer | Size of each page. | 50 |
| total | Integer | Total number of data sources. | 6 |
Common Data Source Response Fields
Each object in the data array contains these common fields.
| Parameter | Type | Description | Example |
|---|---|---|---|
| datasourceId | String | Data source ID. | ds-d92mr1g445le |
| orgId | String | Organization ID. | 2697478995911717 |
| name | String | Data source name. | Production MySQL |
| datasourceType | String | Data source type. | MYSQL |
| username | String | Account used to access the data source. | root |
| host | String | Data source connection address. | 127.0.0.1 |
| port | Integer | Data source port. | 3306 |
| envId | String | Environment of the data source. | env-dev |
| regionId | String | Region of the data source. | aliyun-cn-hangzhou |
| networkType | String | Access type: public, gateway, ssh, or private. | public |
| multiTag | String | Multi-active mark. This field may be empty when not configured. | active |
| sslConfig | Object | SSL configuration. This field may be returned only for MySQL, SQLServer, and PostgreSQL data sources. | {"securityConfig":"PREFERRED"} |
| gatewayId | String | Gateway ID. | gateway-001 |
| tunnelId | String | Private connection ID. | tunnel-001 |
| accessId | String | Cloud access credential ID. | access-001 |
| instanceId | String | Cloud instance ID. | instance-001 |
| env | String | Environment identifier. | product |
| instanceType | String | Instance type. | RDS |
| cloudInstanceType | String | Cloud instance access type. | instance |
| vendorRegionId | String | Cloud vendor region ID. | cn-hangzhou |
| serverVersion | String | Database server version. | 8.0 |
| sshConfig | Object | SSH connection settings. | {} |
| status | String | Data source status, for example, available or unavailable. | available |
| masterName | String | Primary node name. | master-1 |
| hostAndPorts | String | Comma-separated multi-node host:port pairs. | host1:port1,host2:port2 |
| extraConfig | Object | Data-source-specific settings. | {} |
| cluster | Object/null | Cluster topology. The value is null for a non-cluster data source; extraConfig.cluster is the same object and its node passwords are masked. | null |
The response masks SSL certificate private keys, SSH passwords and private keys, and cluster node passwords. When the current account is not an administrator and the organization hides addresses, the response omits host, port, and hostAndPorts.
SSL Configuration Response Fields
When an object in the data array contains sslConfig, sslConfig may include these fields. Supported fields vary by data source type.
| Parameter | Type | Applicable Data Sources | Description | Example |
|---|---|---|---|---|
| sslConfig.securityConfig | String | MySQL, PostgreSQL | SSL security mode. MySQL values: REQUIRED, PREFERRED; PostgreSQL values: Prefer, Require, Verify-CA, Verify-Full. | PREFERRED |
| sslConfig.sslCipher | String | MySQL | SSL cipher suite. | TLS_AES_256_GCM_SHA384 |
| sslConfig.sslCA | String | MySQL, SQLServer, PostgreSQL | CA certificate content. | -----BEGIN CERTIFICATE----- |
| sslConfig.sslCAFileName | String | MySQL, SQLServer, PostgreSQL | CA certificate file name. | ca.pem |
| sslConfig.sslClientCert | String | MySQL, PostgreSQL | Client certificate content. | -----BEGIN CERTIFICATE----- |
| sslConfig.sslClientCertFileName | String | MySQL, PostgreSQL | Client certificate file name. | client-cert.pem |
| sslConfig.sslClientKey | String | MySQL, PostgreSQL | Client private key content. | -----BEGIN PRIVATE KEY----- |
| sslConfig.sslClientKeyFileName | String | MySQL, PostgreSQL | Client private key file name. | client-key.pem |
| sslConfig.sslIndentify | Boolean | MySQL | Whether to verify the server identity. Use the field name sslIndentify as required by the API. | false |
| sslConfig.hostNameInCertificate | String | SQLServer | Host name in the server certificate. | db.example.com |
| sslConfig.trustServerCertificate | Boolean | SQLServer | Whether to trust the server certificate. | false |
MongoDB Data Source Response Fields
When an object in the data array is a MongoDB data source, these MongoDB-specific fields are returned in addition to common fields.
| Parameter | Type | Description | Example |
|---|---|---|---|
| deploymentType | String | MongoDB deployment type. Values: standalone, replicaSet, shardedCluster. | standalone |
| authDB | String | Authentication database. | admin |
| readPreference | String | Read preference. If the data source is not configured with this parameter, the field may be absent or empty. | primary |
| replicaSet | String | Replica set name. If the data source is not configured with this parameter, the field may be absent or empty. | rs0 |
Successful Invocation Example
{
"success": true,
"requestId": "Mi6y0FCN-BHEEaHAnCFFp9DFdAAk0OUZ",
"data": [{
"datasourceId": "ds-d92mr1g445le",
"orgId": "2697478995911717",
"name": "127.0.0.1",
"datasourceType": "MySQL",
"username": "root",
"host": "127.0.0.1",
"port": 3306,
"envId": "env-dev",
"regionId": "aliyun-cn-hangzhou",
"networkType": "public",
"multiTag": "active",
"sslConfig": {
"securityConfig": "PREFERRED",
"sslIndentify": false
}
}],
"current": 1,
"pageSize": 10,
"total": 1
}
MongoDB data source response example:
{
"success": true,
"requestId": "Mi6y0FCN-BHEEaHAnCFFp9DFdAAk0OUZ",
"data": [{
"datasourceId": "ds-d92r4i7z1a90",
"orgId": "2056935997355584",
"name": "test-mongo-standalone-renamed",
"datasourceType": "MongoDB",
"username": "root",
"host": "192.168.1.10",
"port": 27017,
"envId": "env-dev",
"regionId": "aliyun-cn-hangzhou",
"networkType": "public",
"deploymentType": "standalone",
"authDB": "admin",
"readPreference": "primary"
}],
"current": 1,
"pageSize": 10,
"total": 1
}
Result
A successful response returns data source records that match the filters. Use datasourceId when you update, delete, monitor, or grant permissions for a data source.