CreateAliyunSmsSNSTextTemplate
API Request
URLs
POST zstack/v1/zwatch/alarms/sns/text-templates/aliyun-sms
Headers
Authorization: OAuth the-session-uuid
Body
Note: In
the preceding sample, both systemTags and userTags are optional.
These two fields can be included in the body structure.
{
"params": {
"sign": "Example",
"alarmTemplateCode": "SMS_153055065",
"eventTemplateCode": "SMS_153055066",
"eventTemplate": "Event ${EVENT_NAME} happend.",
"name": "aliyunSMS Template",
"applicationPlatformType": "AliyunSms",
"template": "Alarm ${ALARM_NAME} changes status to ${ALARM_CURRENT_STATUS}",
"defaultTemplate": true
},
"systemTags": [],
"userTags": []
}

Curl
Sample
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X POST -d '{"params":{"sign":"Example","alarmTemplateCode":"SMS_153055065","eventTemplateCode":"SMS_153055066","eventTemplate":"Event ${EVENT_NAME} happend.","name":"aliyunSMS Template","applicationPlatformType":"AliyunSms","template":"Alarm ${ALARM_NAME} changes status to ${ALARM_CURRENT_STATUS}","defaultTemplate":true}}' http://localhost:8080/zstack/v1/zwatch/alarms/sns/text-templates/aliyun-sms
Request Parameters
Name | Type | Location | Description | Optional Value | Starting Version |
---|---|---|---|---|---|
sign | String | body (contained in the params structure) | The SMS signature. | 3.7.0 | |
alarmTemplateCode | String | body (contained in the params structure) | The resource alarm template code. | 3.7.0 | |
eventTemplateCode | String | body (contained in the params structure) | The event alarm template code. | 3.7.0 | |
eventTemplate | String | body (contained in the params structure) | Optional. The event alarm template text. | 3.7.0 | |
name | String | body (contained in the params structure) | The template name. | 3.7.0 | |
description | String | body (contained in the params structure) | Optional. The detailed description of the template. | 3.7.0 | |
applicationPlatformType | String | body (contained in the params structure) | The type of the SNS application platform. | 3.7.0 | |
template | String | body (contained in the params structure) | The resource alarm template text. | 3.7.0 | |
recoveryTemplate | String | body (contained in the params structure) | Optional. The recovery template text. | 3.7.0 | |
defaultTemplate | Boolean | body (contained in the params structure) | Optional. Whether to set the template as the default template. | 3.7.0 | |
resourceUuid | String | body (contained in the params structure) | Optional. | 3.7.0 | |
tagUuids | List | body (contained in the params structure) | Optional. The tag UUID list. | 3.7.0 | |
systemTags | List | body | Optional. The system tags. | 3.7.0 | |
userTags | List | body | Optional. The user tags. | 3.7.0 |
API Response
Sample
Response
{
"inventory": {
"uuid": "335d5580cfad41d98e699d5d80830818",
"name": "email template",
"applicationPlatformType": "Email",
"template": "Alarm ${ALARM_NAME} changes status to ${ALARM_CURRENT_STATUS}",
"recoveryTemplate": "Resource ${EVENT_RESOURCE_ID} changes status to ${ALARM_CURRENT_STATUS}",
"defaultTemplate": false,
"createDate": "Oct 8, 2019 5:31:52 PM",
"lastOpDate": "Oct 8, 2019 5:31:52 PM"
}
}
Name | Type | Description | Starting Version |
---|---|---|---|
error | ErrorCode | The error code. If not null, the operation fails, or vice versa. For more information, see error. | 3.7.0 |
inventory | SNSTextTemplateInventory | See inventory. | 3.7.0 |
#error
Name | Type | Description | Starting Version |
---|---|---|---|
code | String | The error code, which is a numbered or alphanumeric code that specifies an error. For example, SYS.1000, HOST.1001. | 3.7.0 |
description | String | The brief description of the error. | 3.7.0 |
details | String | The details about the error. | 3.7.0 |
elaboration | String | The reserved field. Default value: null. | 3.7.0 |
opaque | LinkedHashMap | The reserved field. Default value: null. | 3.7.0 |
cause | ErrorCode | The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. | 3.7.0 |
#inventory
Name | Type | Description | Starting Version |
---|---|---|---|
uuid | String | The resource UUID. | 3.7.0 |
name | String | Th resource name. | 3.7.0 |
description | String | The detailed description of the resource. | 3.7.0 |
applicationPlatformType | String | The application platform type. | 3.7.0 |
template | String | The template text. | 3.7.0 |
recoveryTemplate | String | The recovery template text. | 3.7.0 |
defaultTemplate | Boolean | Whether to set the template as the default template. | 3.7.0 |
createDate | Timestamp | The creation date. | 3.7.0 |
lastOpDate | Timestamp | The last operation date. | 3.7.0 |
SDK Sample
Java
SDK
CreateAliyunSmsSNSTextTemplateAction action = new CreateAliyunSmsSNSTextTemplateAction();
action.sign = "Example";
action.alarmTemplateCode = "SMS_153055065";
action.eventTemplateCode = "SMS_153055066";
action.eventTemplate = "Event ${EVENT_NAME} happend.";
action.name = "aliyunSMS Template";
action.applicationPlatformType = "AliyunSms";
action.template = "Alarm ${ALARM_NAME} changes status to ${ALARM_CURRENT_STATUS}";
action.defaultTemplate = true;
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
CreateAliyunSmsSNSTextTemplateAction.Result res = action.call();
Python
SDK
CreateAliyunSmsSNSTextTemplateAction action = CreateAliyunSmsSNSTextTemplateAction()
action.sign = "Example"
action.alarmTemplateCode = "SMS_153055065"
action.eventTemplateCode = "SMS_153055066"
action.eventTemplate = "Event ${EVENT_NAME} happend."
action.name = "aliyunSMS Template"
action.applicationPlatformType = "AliyunSms"
action.template = "Alarm ${ALARM_NAME} changes status to ${ALARM_CURRENT_STATUS}"
action.defaultTemplate = true
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
CreateAliyunSmsSNSTextTemplateAction.Result res = action.call()