Updated on 2026-09-07 GMT+08:00

Testing Connections in Batches

Function

This API is used to test connections in batches.

Debugging

You can debug the API in API Explorer to support automatic authentication. API Explorer can automatically generate and debug example SDK code.

Authorization Information

Each account has all the permissions required to call all APIs, but IAM users must be assigned the required permissions. For details about the required permissions, see Permissions and Supported Actions.

Constraints

  • After the task is created, you can test the connection only when the task status is CONFIGURATION.
  • In the dual-active DR scenario, the backward task can be executed only when the forward task is in INCRE_TRANSFER_STARTED state. The parent task cannot call the API.
  • To ensure API performance, it is recommended that a single batch contain no more than 10 tasks.

URI

POST /v3/{project_id}/jobs/batch-connection

Table 1 URI parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Definition

Project ID of a tenant in a region.

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

Constraints

N/A

Range

N/A

Default Value

N/A

Request Parameters

Table 2 Request header parameters

Parameter

Mandatory

Type

Description

Content-Type

Yes

String

Definition

MIME type of the request body. Use the default value application/json. For APIs used to upload objects or images, the value varies depending on the flow type.

Constraints

N/A

Range

application/json

Default Value

application/json

X-Auth-Token

Yes

String

Definition

User token obtained from IAM. It is a response to the API for obtaining a user token. This API is the only one that does not require authentication. The token is the value of X-Subject-Token in the response header.

Constraints

N/A

Range

N/A

Default Value

N/A

X-Language

No

String

Definition

Request language type.

Constraints

N/A

Range

  • en-us: English
  • zh-cn: Chinese

Default Value

en-us

Table 3 Request body parameters

Parameter

Mandatory

Type

Description

jobs

Yes

Array of objects

Definition

List of batch connection test requests, which specifies the tasks whose connections need to be tested and the database connection information.

For details, see Table 4.

Table 4 Data structure description of field jobs

Parameter

Mandatory

Type

Description

id

Yes

String

Definition

DRS task ID, which uniquely identifies a data replication task. You can obtain the task ID from the task list or task details page.

Constraints

N/A

Range

N/A

Default Value

N/A

net_type

Yes

String

Definition

Type of the network used by the task.

Constraints

N/A

Range

  • vpn
  • vpc
  • eip

Default Value

N/A

db_type

Yes

String

Definition

Database type, which indicates the DB engine type of the source or destination database.

Constraints

N/A

Range

  • mysql: MySQL
  • mongodb: MongoDB
  • gaussdbv5: GaussDB Distributed
  • taurus: TaurusDB
  • gaussdbv5ha: GaussDB Centralized
  • kafka: Kafka
  • postgresql: PostgreSQL
  • oracle: Oracle

Default Value

N/A

ip

Yes

String

Definition

Database IP address, which is used to specify the server address for connecting to the database.

Constraints

N/A

Range

N/A

Default Value

N/A

db_port

No

Integer

Definition

Database port number, which is used to specify the service port for connecting to the database.

Constraints

  • This parameter is mandatory and must be set to 0 when db_type is set to MongoDB or DDS.

  • This parameter is mandatory when db_type is set to Oracle.

Range

N/A

Default Value

N/A

inst_id

No

String

Definition

DB instance ID. This parameter is mandatory when the database is a cloud instance, for example, an RDS instance.

Constraints

N/A

Range

N/A

Default Value

N/A

db_user

Yes

String

Definition

Username used to connect to the database.

Constraints

N/A

Range

N/A

Default Value

N/A

db_password

Yes

String

Definition

Database password, which is used for authentication when the database is connected.

Constraints

N/A

Range

N/A

Default Value

N/A

ssl_link

No

Boolean

Definition

Whether to use SSL connection. This parameter specifies whether to enable SSL encrypted transmission for database connections.

Constraints

If this parameter is set to true, you need to set parameters related to the SSL certificate.

Range

  • true: SSL connection is used.

  • false: SSL connection is not used.

Default Value

N/A

ssl_cert_key

No

String

Definition

SSL certificate content, which is a character string encrypted using Base64 after the SSL certificate is obtained.

Constraints

This parameter is mandatory when ssl_link is set to true.

Range

N/A

Default Value

N/A

ssl_cert_name

No

String

Definition

SSL certificate name.

Constraints

This parameter is mandatory when ssl_link is set to true.

Range

N/A

Default Value

N/A

ssl_cert_check_sum

No

String

Definition

The checksum value of the SSL certificate content encrypted using SHA-256 after the SSL certificate is obtained, which is used for backend verification.

Constraints

This parameter is mandatory when ssl_link is set to true.

Range

N/A

Default Value

N/A

ssl_cert_password

No

String

Definition

SSL certificate password.

Constraints

If the certificate file name extension is .p12, you need to enter the password.

Range

N/A

Default Value

N/A

vpc_id

No

String

Definition

ID of the VPC where the database is located.

Constraints

This parameter is mandatory when the network type is set to VPC.

Range

N/A

Default Value

N/A

subnet_id

No

String

Definition

ID of the subnet where the database is located.

Constraints

This parameter is mandatory when the network type is set to VPC.

Range

N/A

Default Value

N/A

end_point_type

Yes

String

Definition

Endpoint type of the database, which indicates whether the database is the source or destination in the data replication task.

Constraints

N/A

Range

  • so: source database
  • ta: destination database

Default Value

so

region

No

String

Definition

Region where the DB instance is located.

Constraints

This parameter is mandatory when the database is a cloud instance, for example, an RDS instance.

Range

N/A

Default Value

N/A

project_id

No

String

Definition

Project ID of the region where the DB instance is located. If the database is a cloud instance, set this parameter to the project ID of the region where the DB instance is located. Otherwise, set this parameter to the project ID of the region where the current task is located. For details about how to obtain the project ID, see section "Obtaining a Project ID".

Constraints

N/A

Range

N/A

Default Value

N/A

db_name

No

String

Definition

Database user name, which is the DDS authentication database or the service name of the Oracle database.

Constraints

N/A

Range

N/A

Default Value

N/A

kafka_security_config

No

Object

Definition

This parameter is only for Kafka security authentication.

For details, see Table 5.

Table 5 Data structure description of field kafka_security_config

Parameter

Mandatory

Type

Description

type

No

String

Definition

Security protocol. This parameter is mandatory for security authentication. The corresponding field for Kafka is security.protocol.

Constraints

N/A

Range

  • PLAINTEXT: No security authentication mode is available. You only need to enter an IP address and a port number.
  • SASL_PLAINTEXT: The SASL mechanism is used to connect to Kafka, and you need to configure SASL parameters.
  • SSL: SSL encryption is used to connect to Kafka, and you need to configure SSL parameters.
  • SASL_SSL: Both SASL and SSL authentication modes are used. You need to configure SSL and SASL parameters.

Default Value

N/A

trust_store_key_name

No

String

Definition

Certificate name.

Constraints

This parameter is mandatory when the security protocol is set to SSL or SASL_SSL.

Range

N/A

Default Value

N/A

trust_store_key

No

String

Definition

Base64-encoded value of the security certificate.

Constraints

This parameter is mandatory when the security protocol is set to SSL or SASL_SSL.

Range

N/A

Default Value

N/A

trust_store_password

No

String

Definition

Certificate password.

Constraints

This parameter is mandatory when security authentication is used.

Range

N/A

Default Value

N/A

endpoint_algorithm

No

String

Definition

Host name endpoint identification algorithm, which specifies the endpoint identification algorithm for verifying the server host name using the server certificate. If this parameter is left blank, host name verification is disabled. The corresponding field for Kafka is ssl.endpoint.identification.algorithm.

Constraints

N/A

Range

N/A

Default Value

N/A

sasl_mechanism

No

String

Definition

SASL mechanism used for client connection. The corresponding Kafka field is sasl.mechanism.

Constraints

This parameter is mandatory when the authentication type is SASL_PLAINTEXT or SASL_SSL.

Range

  • GSSAPI
  • PLAIN
  • SCRAM-SHA-256
  • SCRAM-SHA-512

Default Value

N/A

delegation_tokens

No

Boolean

Definition

Whether to use delegation tokens for authentication.

Constraints

This parameter is valid only when the security protocol is set to SASL_SSL or SASL_PLAINTEXT and the SASL mechanism is set to SCRAM-SHA-256 or SCRAM-SHA-512.

Range

N/A

Default Value

N/A

enable_key_store

No

Boolean

Definition

Whether to enable two-way SSL authentication.

Constraints

N/A

Range

  • true: Two-way SSL authentication is enabled.

  • false: Two-way SSL authentication is disabled.

Default Value

N/A

key_store_key

No

String

Definition

Keystore certificate.

Constraints

This parameter is required when two-way SSL authentication is enabled.

Range

N/A

Default Value

N/A

key_store_key_name

No

String

Definition

Keystore certificate name.

Constraints

This parameter is required when two-way SSL authentication is enabled.

Range

N/A

Default Value

N/A

key_store_password

No

String

Definition

Keystore certificate password. The corresponding Kafka field is ssl.keystore.password.

Constraints

This parameter is required when a password is set for the certificate.

Range

N/A

Default Value

N/A

set_private_key_password

No

Boolean

Definition

Whether to set the keystore private key password.

Constraints

N/A

Range

  • true: The keystore private key password is set.
  • false: The keystore private key password is not set.

Default Value

false

key_password

No

String

Definition

Keystore private key password. The corresponding Kafka field is ssl.key.password.

Constraints

This parameter is mandatory when two-way SSL authentication is enabled and set_private_key_password is set to true.

Range

N/A

Default Value

N/A

Response Parameters

Status code: 200

Table 6 Response body parameters

Parameter

Type

Description

results

Array of objects

Definition

Response body set for testing connections in batches, including the connection test result of each task.

For details, see Table 7.

count

Integer

Definition

Total number of returned task records, which is consistent with the length of the results array.

Constraints

N/A

Range

N/A

Table 7 Data structure description of field results

Parameter

Type

Description

id

String

Definition

Task ID, which uniquely identifies a data replication task.

Constraints

N/A

Range

N/A

status

String

Definition

Test result status.

Constraints

N/A

Range

  • success: indicates that the connection test is successful.
  • failed: indicates that the connection test fails.

error_code

String

Definition

Error code returned if the task fails.

Constraints

N/A

Range

The value is in the format of DRS.XXXXXX.

error_msg

String

Definition

Error message returned if the task fails.

Constraints

N/A

Range

N/A

success

Boolean

Definition

Whether the operation is successful. It indicates the execution result of the connection test.

Constraints

  • true: The operation is successful.

  • false: The operation failed.

Range

N/A

Example Request

  • Testing connections for a DDS real-time migration task in which the destination database is DDS
    https://{endpoint}/v3/054ba152d480d55b2f5dc0069e7ddef0/jobs/batch-connection
    
    {
      "jobs" : [ {
        "id" : "140b5236-88ad-43c8-811c-1268453jb101",
        "ip" : "192.168.4.66:8635,192.168.4.83:8635",
        "net_type" : "eip",
        "db_type" : "mongodb",
        "db_port" : 0,
        "db_user" : "root",
        "db_password" : "********",
        "inst_id" : "3cadd5a0ef724f55ac7fa5bcb5f4fc5fin02",
        "project_id" : "0549a6a31000d4e82fd1c00c3d6f2d76",
        "region" : "cn-xianhz-1",
        "end_point_type" : "ta"
      } ]
    }
  • Testing connections for an RDS for MySQL real-time migration task in which the destination database is RDS for MySQL
    https://{endpoint}/v3/054ba152d480d55b2f5dc0069e7ddef0/jobs/batch-connection
    
    {
      "jobs" : [ {
        "id" : "140b5236-88ad-43c8-811c-1268453jb101",
        "ip" : "192.168.0.131",
        "net_type" : "eip",
        "db_type" : "mysql",
        "db_port" : 3306,
        "db_user" : "root",
        "db_password" : "********",
        "inst_id" : "e05a3679efe241d8b5dee80b17c1a863in01",
        "project_id" : "054ba152d480d55b2f5dc0069e7ddef0",
        "region" : "cn-xianhz-1",
        "end_point_type" : "ta"
      } ]
    }
  • Testing connections for a MySQL real-time migration task in which the source database is not RDS
    https://{endpoint}/v3/054ba152d480d55b2f5dc0069e7ddef0/jobs/batch-connection
    
    {
      "jobs" : [ {
        "id" : "140b5236-88ad-43c8-811c-1268453jb101",
        "ip" : "192.168.0.27",
        "net_type" : "eip",
        "db_type" : "mysql",
        "db_port" : 3306,
        "db_user" : "root",
        "db_password" : "********",
        "ssl_link" : false,
        "end_point_type" : "so"
      } ]
    }
  • Creating a real-time synchronization task from MySQL to Kafka and setting the Kafka authentication mode to PLAINTEXT
    https://{endpoint}/v3/054ba152d480d55b2f5dc0069e7ddef0/jobs/batch-connection
    
    {
      "jobs": [
        {
          "id": "3bc38fe4-da50-4aad-903e-5db76d8jb20i",
          "ip": "xxxxxxx:xxxx",
          "net_type": "eip",
          "db_type": "kafka",
          "project_id": "5237e10fe9aa4ad5b16b6a5245248314",
          "end_point_type": "ta",
          "kafka_security_config": {
            "type": "PLAINTEXT"
          }
        }
      ]
    }
  • Creating a real-time synchronization task from MySQL to Kafka and setting the Kafka authentication mode to SASL_PLAINTEXT
    https://{endpoint}/v3/054ba152d480d55b2f5dc0069e7ddef0/jobs/batch-connection
    
    {
      "jobs": [
        {
          "id": "3bc38fe4-da50-4aad-903e-5db76d8jb20i",
          "ip": "xxxxxxx:xxxx",
          "net_type": "eip",
          "db_type": "kafka",
          "db_user": "xxxxxxx",
          "db_password": "xxxxxxx",
          "project_id": "5237e10fe9aa4ad5b16b6a5245248314",
          "end_point_type": "ta",
          "kafka_security_config": {
            "type": "SASL_PLAINTEXT",
            "sasl_mechanism": "PLAIN"
          }
        }
      ]
    }
  • Creating a real-time synchronization task from MySQL to Kafka and setting the Kafka authentication mode to SSL
    https://{endpoint}/v3/054ba152d480d55b2f5dc0069e7ddef0/jobs/batch-connection
    
    {
      "jobs": [
        {
          "id": "3bc38fe4-da50-4aad-903e-5db76d8jb20i",
          "ip": "xxxxxxx:xxxx",
          "net_type": "eip",
          "db_type": "kafka",
          "project_id": "5237e10fe9aa4ad5b16b6a5245248314",
          "end_point_type": "ta",
          "kafka_security_config": {
            "type": "SSL",
            "trust_store_key_name": "client.truststore.jks",
            "trust_store_key": "xxxxxx",
            "trust_store_password": "xxxxxx",
            "endpoint_algorithm": "",
            "enable_key_store": false
          }
        }
      ]
    }
  • Creating a real-time synchronization task from MySQL to Kafka and setting the Kafka authentication mode to SASL_SSL
    https://{endpoint}/v3/054ba152d480d55b2f5dc0069e7ddef0/jobs/batch-connection
    
    {
      "jobs": [
        {
          "id": "3bc38fe4-da50-4aad-903e-5db76d8jb20i",
          "ip": "xxxxxxx:xxxx",
          "net_type": "eip",
          "db_type": "kafka",
          "db_user": "xxxxxxx",
          "db_password": "xxxxxxx",
          "project_id": "5237e10fe9aa4ad5b16b6a5245248314",
          "end_point_type": "ta",
          "kafka_security_config": {
            "type": "SSL",
            "trust_store_key_name": "client.truststore.jks",
            "trust_store_key": "xxxxxx",
            "trust_store_password": "xxxxxx",
            "endpoint_algorithm": "",
            "enable_key_store": false
          }
        }
      ]
    }

Example Response

Status code: 200

OK

{
  "results" : [ {
    "success" : true,
    "id" : "140b5236-88ad-43c8-811c-1268453jb101",
    "status" : "success"
  } ],
  "count" : 1
}

Status Code

Status Code

Description

200

OK

400

Bad Request

For other statuses, see Status Code.

Error Code

For details, see Error Code.