CreateSNSEmailPlatform
API Request
URLs
POST zstack/v1/sns/application-platforms/emailHeaders
Authorization: OAuth the-session-uuidBody
Note: In the above example, the systemTags and userTags fields are optional. They are listed to indicate that the body can contain these two fields.
{
"params": {
"smtpServer": "email.zstack.io",
"smtpPort": 20.0,
"username": "example@cloud.io",
"password": "password",
"encryptType": "STARTTLS",
"name": "email platform"
},
"systemTags": [],
"userTags": []
}
Note: In the above example, the systemTags and userTags fields are optional. They are listed to indicate that the body can contain these two fields.Curl Example
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X POST -d '{"params":{"smtpServer":"email.zstack.io","smtpPort":20.0,"username":"example@cloud.io",
"password":"password","encryptType":"STARTTLS","name":"email platform"}}' \
http://localhost:8080/zstack/v1/sns/application-platforms/emailParameter List
Note:
| Name | Type | Location | Description | Allowed Values | Starting Version |
|---|---|---|---|---|---|
| smtpServer | String | body (contained in the params structure) | SMTP server address | 2.3 | |
| smtpPort | Integer | body (contained in the params structure) | SMTP port | 2.3 | |
| username | String | body (contained in the params structure) | Username | 4.1.0 | |
| password (Optional) | String | body (contained in the params structure) | Password | 2.3 | |
| name | String | body (contained in the params structure) | Resource name | 2.3 | |
| description (Optional) | String | body (contained in the params structure) | Detailed description of the resource | 2.3 | |
| resourceUuid (Optional) | String | body (contained in the params structure) | Optional. The resource UUID. | 2.3 | |
| encryptType (Optional) | String | body (contained in the params structure) | Optional. The encrypt type. |
|
2.3 |
| systemTags (Optional) | List | body | System tags | 2.3 | |
| userTags (Optional) | List | body | User tags | 2.3 |
Note:
- When adding an email server, the system automatically validates the username, password, email server address, email server port, and encryption type. The validation takes no more than 5 seconds.
API Response
Response Example
{
"inventory": {
"uuid": "a5c6d18fdf9b4b6fbdb1f49abce0328c",
"name": "email platform",
"description": "example description",
"state": "Enabled",
"type": "Email",
"createDate": "Mar 26, 2024 2:42:32 AM",
"lastOpDate": "Mar 26, 2024 2:42:32 AM"
}
}#error
| Name | Type | Description | Starting Version |
|---|---|---|---|
| code | String | The error code number. A globally unique identifier for the error, for example, SYS.1000, HOST.1001 | 0.6 |
| description | String | A brief description of the error | 0.6 |
| details | String | Detailed information about the error | 0.6 |
| elaboration | String | Reserved field. Default is null | 0.6 |
| opaque | LinkedHashMap | Reserved field. Default is null | 0.6 |
| cause | ErrorCode | The root error that caused the current error. If there is no root error, this field is null | 0.6 |
#inventory
| Name | Type | Description | Starting Version |
|---|---|---|---|
| uuid | String | The UUID of the resource, which uniquely identifies the resource | 2.3 |
| name | String | Resource name | 2.3 |
| description | String | Detailed description of the resource | 2.3 |
| type | String | Type | 2.3 |
| createDate | Timestamp | Creation time | 2.3 |
| lastOpDate | Timestamp | Last modification time | 2.3 |
SDK Examples
Java
SDK
CreateSNSEmailPlatformAction action = new CreateSNSEmailPlatformAction();
action.smtpServer = "email.zstack.io";
action.smtpPort = 20.0;
action.username = "example@cloud.io";
action.password = "password";
action.encryptType = "STARTTLS";
action.name = "email platform";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
CreateSNSEmailPlatformAction.Result res = action.call();Python
SDK
CreateSNSEmailPlatformAction action = CreateSNSEmailPlatformAction()
action.smtpServer = "email.zstack.io"
action.smtpPort = 20.0
action.username = "example@cloud.io"
action.password = "password"
action.encryptType = "STARTTLS"
action.name = "email platform"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
CreateSNSEmailPlatformAction.Result res = action.call()