Call CreateConnection to create a data source.
Debugging
Request parameters
Parameter | Type | Required | Example | Description |
---|---|---|---|---|
Action | String | Required | CreateConnection |
The operation that you want to perform. |
ConnectionType | String | Required | rds |
The type of the connection string. |
Content | String | Required | {"database":"dbname","instanceName":"instancename","password":"password","rdsOwnerId":"123","username":"username"} |
Details of the data source. |
EnvType | Integer | Yes | 1 |
Environment of the data source. |
Name | String | Required | abc |
The name of the data source. |
ProjectId | Long | Yes | 1 |
The ID of the workspace to be associated with the data source. |
RegionId | String | Required | cn-shanghai |
The ID of the region where your project resides. |
Description | String | No | abc |
The description of the connection string. |
SubType | String | No | mysql |
The sub-type of a connection string. |
Response parameters
Parameter | Type | Example | Description |
---|---|---|---|
Data | Long | 123 |
The ID of the data source. |
HttpStatusCode | String | 200 |
The HTTP status code. |
RequestId | String | 0bc141151593763**** |
The ID of the request. |
Success | Boolean | true |
Indicates whether the request is successful. A value of true indicates that the request is successful. A value of false indicates that the request has failed. |
Examples
Sample requests
http(s)://[Endpoint]/? Action=CreateConnection
&ConnectionType=rds
&Content={"database":"dbname","instanceName":"instancename","password":"password","rdsOwnerId":"123","username":"username"}
&EnvType=1
&Name=abc
&ProjectId=1
&RegionId=cn-shanghai
&<Common request parameters>
Sample success responses
XML
format
<RequestId>0bc141151593763****</RequestId>
<HttpStatusCode>200</HttpStatusCode>
<Data>123</Data>
<Success>true</Success>
JSON
format
{
"RequestId": "0bc141151593763****",
"HttpStatusCode": 200,
"Data": 123,
"Success": true
}
Error codes
HttpCode | Error code | Error message | Description |
---|---|---|---|
400 | Invalid.Tenant.ConnectionNotExists | The connection does not exist. | The data source does not exist. |
400 | Invalid.Tenant.ProjectNotExists | The project does not exist. | The error message returned because the specified project does not exist. |
403 | Invalid.Tenant.UserIsNotProjectOwnerOrAdmin | The user is not a project administrator or owner. | The user is not the project owner or project administrator. |
400 | Invalid.Tenant.UserNotInProject | The user is not in the project. | The user is not in the project. |
403 | Invalid.Tenant.UserNotInTenant | The user is not in tenant. | User is not in tenant. |
For a list of error codes, visit the API Error Center.