Create Email Server

POST/zstack/v1/sns/application-platforms/email

Headers

Authorization: OAuth the-session-uuid

Body

{
  "params": {
    "smtpServer": "email.zstack.io",
    "smtpPort": 20.0,
    "username": "example@cloud.io",
    "password": "password",
    "encryptType": "STARTTLS",
    "name": "email platform"
  },
  "systemTags": [],
  "userTags": []
}

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/email

Parameter List

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)

 

 

2.3

encryptType (Optional)

String

body (contained in the params structure)

 

  • SSL
  • STARTTLS
  • NONE

2.3

systemTags (Optional)

List

body

System tags

 

2.3

userTags (Optional)

List

body

User tags

 

2.3

  • 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"
  }
}
NameTypeDescriptionStarting Version
errorErrorCodeThe error code. If not null, the operation failed. This field is null on success. See error2.3
inventorySNSApplicationPlatformInventorySee inventory2.3

error

NameTypeDescriptionStarting Version
codeStringThe error code number. A globally unique identifier for the error, for example, SYS.1000, HOST.10010.6
descriptionStringA brief description of the error0.6
detailsStringDetailed information about the error0.6
elaborationStringReserved field. Default is null0.6
opaqueLinkedHashMapReserved field. Default is null0.6
causeErrorCodeThe root error that caused the current error. If there is no root error, this field is null0.6

inventory

NameTypeDescriptionStarting Version
uuidStringThe UUID of the resource, which uniquely identifies the resource2.3
nameStringResource name2.3
descriptionStringDetailed description of the resource2.3
typeStringType2.3
createDateTimestampCreation time2.3
lastOpDateTimestampLast modification time2.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()