Skip to main content

Create Data Source

Create a new database connection configuration in NineData.

Request URL: /openapi/v1/datasource/create

Request Method: POST

Request Parameters

ParameterTypeRequiredDescriptionExample
datasourceTypeStringYesType of data source. Values: MySQL, PostgreSQL, SQLServer, Dameng, KingBaseMySQL
nameStringYesSpecify the name of the data source.Production Environment MySQL
usernameStringNoAccount for accessing the data source.Root
passwordStringNoPassword for accessing the data source.Root
hostStringYesConnection address of the data source.192.168.1.1
portIntegerNoPort number of the data source.3306
envIdStringYesBind this data source to a specific environment. You can call the List Environments API to get envId.env-product
regionIdStringYesSpecify the region where the data source belongs. You can call the List Regions API to get regionId.aliyun-cn-hangzhou
networkTypeStringYesSpecify the connection method of the data source. Currently, only public network access is supported, with the value being Public.Public

Return Parameters

ParameterTypeDescriptionExample
successBoolWhether the API call was successful. Return values: true, false.true
requestIdStringRequest ID.Mi6y0FCN-BHEEaHAnCFFp9DFdAAk0OUZ
dataArrayDetails 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"
}
}