Create Data Source
Create a new database connection configuration in NineData.
Request URL: /openapi/v1/datasource/create
Request Method: POST
Request Parameters
Parameter | Type | Required | Description | Example |
---|---|---|---|---|
datasourceType | String | Yes | Type of data source. Values: MySQL, PostgreSQL, SQLServer, Dameng, KingBase | MySQL |
name | String | Yes | Specify the name of the data source. | Production Environment MySQL |
username | String | No | Account for accessing the data source. | Root |
password | String | No | Password for accessing the data source. | Root |
host | String | Yes | Connection address of the data source. | 192.168.1.1 |
port | Integer | No | Port number of the data source. | 3306 |
envId | String | Yes | Bind this data source to a specific environment. You can call the List Environments API to get envId . | env-product |
regionId | String | Yes | Specify the region where the data source belongs. You can call the List Regions API to get regionId . | aliyun-cn-hangzhou |
networkType | String | Yes | Specify the connection method of the data source. Currently, only public network access is supported, with the value being Public . | Public |
Return Parameters
Parameter | Type | Description | Example |
---|---|---|---|
success | Bool | Whether the API call was successful. Return values: true , false . | true |
requestId | String | Request ID. | Mi6y0FCN-BHEEaHAnCFFp9DFdAAk0OUZ |
data | Array | Details of the created data source, including data source ID (datasourceId) information. | { "datasourceId": "ds-d92r4i7z1a90" } |
Successful Invocation Example
{
"success": true,
"requestId": "Uf0f0KQB-BHEEjCWnCGHo9FSdCBi1GPC",
"data": {
"datasourceId": "ds-d92r4i7z1a90"
}
}