Querying a Connection List

Function

This API is used to query a connection list.

URI

  • URI format

    GET /v1/{project_id}/connections?offset={offset}&limit={limit}&connectionName={connectionName}

  • Parameter description
    Table 1 URI parameter description

    Parameter

    Mandatory

    Type

    Description

    project_id

    Yes

    String

    Project ID. For details about how to obtain the project ID, see Obtaining a Project ID.

    offset

    No

    Integer

    The value is no less than 0. The default value is 0.

    limit

    No

    Integer

    The maximum number of records on each page. Value range: 1 to 100

    Default value: 10

    connectionName

    No

    String

    Name of the connection.

Request Message

Table 2 Request header parameters

Parameter

Mandatory

Type

Description

workspace

No

String

Workspace ID.

  • If this parameter is not set, data in the default workspace is queried by default.
  • If you need to query data in other workspaces, this header must be carried.

Response Message

Parameter

Mandatory

Type

Description

total

Yes

Integer

The total number of connections.

connections

Yes

List<Connection>

Connection list.

Table 3 Connection parameter description

Parameter

Mandatory

Type

Description

name

Yes

String

Name of the connection. The name consists of a maximum of 100 characters. Only letters, digits, hyphens (-), and underscores (_) are allowed. The connection name must be unique.

type

Yes

String

Connection type. The options are as follows:

  • DWS
  • DLI
  • SparkSQL
  • HIVE
  • RDS
  • CloudTable

config

No

Map<String,String>

Connection configuration item. The configuration item varies with the connection type. You do not need to set the config parameter for the DLI connection. For other types of connections, see the description of connection configuration items.

description

No

String

The description contains a maximum of 255 characters.

Example

Query a connection list.

  • Request
    GET /v1/b384b9e9ab9b4ee8994c8633aabc9505/connections
  • Success response

    HTTP status code 200

    {
        "total":1,
        "connections":[
            {
                "name":"connection1",
                "type":"DWS",
                "config":{
                    "clusterName":"test",
                    "userName":"dbadmin",
                    "password":"test1234",
                    "kmsKey":"cdm-dlf",
                    "agentName":"cdm-donotdelete",
                    "sslEnable":false
                }
            }
        ]
    }
  • Failure response

    HTTP status code 400

    {
        "error_code":"DLF.3051",
        "error_msg":"The request parameter is invalid."
    }