Help Center/ MapReduce Service/ API Reference/ API V2/ Data Connection Management/ Creating a Data Connection - CreateDataConnector
Updated on 2026-06-27 GMT+08:00

Creating a Data Connection - CreateDataConnector

Function

This API is used to create a data connection.

Constraints

None

Debugging

You can debug this API in API Explorer, which supports automatic authentication and authorization. API Explorer can automatically generate sample SDK code and supports sample SDK code debugging.

Authorization Information

Each account has all the permissions required to call all APIs, but IAM users must be assigned the required permissions.

  • If you are using role/policy-based authorization, see Permissions Policies and Supported Actions for details on the required permissions.
  • If you are using identity policy-based authorization, the following identity policy-based permissions are required.

    Action

    Access Level

    Resource Type (*: required)

    Condition Key

    Alias

    Dependency

    mrs:dataConnector:updateInstance

    Write

    -

    -

    -

    -

URI

POST /v2/{project_id}/data-connectors

Table 1 URI parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Definition

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

Constraints

N/A

Range

The value must consist of 1 to 64 characters. Only letters and digits are allowed.

Default Value

N/A

Request Parameters

Table 2 Request body parameters

Parameter

Mandatory

Type

Description

data_connector

Yes

object

Definition

Data connection. For details, see Table 3.

Constraints

N/A

Range

N/A

Default Value

N/A

Table 3 DataConnector

Parameter

Mandatory

Type

Description

connector_name

Yes

String

Definition

Data connection name.

Constraints

N/A

Range

N/A

Default Value

N/A

source_type

Yes

String

Definition

Data connection type.

Constraints

N/A

Range

  • RDS_POSTGRES: RDS PostgreSQL database
  • RDS_MYSQL: RDS MySQL database
  • gaussdb-mysql: TaurusDB

Default Value

N/A

source_info

Yes

String

Definition

Data source information, which is in JSON format.

Constraints

N/A

Range

N/A

Default Value

N/A

Response Parameters

Status code: 201

Table 4 Response body parameters

Parameter

Type

Description

connector_id

String

Definition

Data connection ID returned after a data connection is created.

Constraints

N/A

Range

N/A

Default Value

N/A

Example Request

Create a MySQL data connection.

/v2/ac66f1a5-e8f4-4399-8ec6-2c8cb1aefda7/data-connector

{
  "data_connector" : {
    "connector_name" : "mrs-mysql-connector",
    "source_type" : "RDS_MYSQL",
    "source_info" : "{\"db_name\":\"default\",\"user_name\":\"mrs\",\"password\":\"*****\",\"rds_instance_id\":\"3aa55f1cb4c3491686936130f21e9f16in01\"}"
  }
}

Example Response

Status code: 201

Data connection created successfully.

{
  "connector_id" : "0822239c1e80d4502f82c008937da9b5"
}

Status Codes

See Status Codes.

Error Codes

See Error Codes.