API: Alert Template operations

Alert Template: JSON Object
JSON Example

{
“Id”: 394,
“Name”: “HTML Template”,
“Subject”: “letter subject”,
“Email_Reply_To”: “”,
“Template_Type”: “Txt”,
“Error_Message”: “Error occured during the device monitoring at \u003c%Monitor_DateTime%\u003e\r\nMonitoring location:\u003c%Location%\u003e\r\n———————————————————–\r\nTask sequence:\r\n\u003c%BAND Responses%\u003e\r\nName -\u003e \u003c%Task_Name%\u003e\r\nTASK -\u003e \u003c%TaskInfo%\u003e\r\nRESPONSE-\u003e Duration:\u003c%Duration%\u003e;Error Code:\u003c%Error_Code%\u003e;Reason:\u003c%Reason%\u003e\r\n***\r\n\u003c%END%\u003e\r\nNetwork TraceRoute: http://dmserver.tc/WebReporting/response/trace.aspx?uid=\u003c%UID%\u003e\u003c%ID:\u0027X\u0027%\u003e\r\nHTML Page snapshot: http://dmserver.tc/WebReporting/response/content.aspx?uid=\u003c%UID%\u003e\u003c%ID:\u0027X\u0027%\u003e\r\n”,
“Test_Message”: “This is a test alert for device \u003c%Site_Name%\u003e. If you have any questions please contact \u003c%Contact_Full_Name%\u003e”,
“Uptime_Message”: “Device \u003c%Site_Name%\u003e detected to be back online at \u003c%Monitor_DateTime%\u003e from monitoring location: \u003c%Location%\u003e”,
“Assigned_To”: [] }

Fields description 

 

Field Type Description

Id

Int32

Template id

Example:

“Id”: 394

Name

String

Template name

Example:
“Name”: “HTML Template”

Subject

String

Letter Subject

Example:

“Subject”: “letter subject”

Email_Reply_To

String

Example:
“Email_Reply_To”: “reply@company.com”

Template_Type

String

This Field defines template (message) type formatPossible values are “HTML” and “TXT”

Example:
“Template_Type”: “Txt”,

Error_Message

String

Example:

“Error_Message”: “Error occured during the device monitoring at \u003c%Monitor_DateTime%\u003e\r\nMonitoring location:\u003c%Location%\u003e\r\n———————————————————–\r\nTask sequence:\r\n\u003c%BAND Responses%\u003e\r\nName -\u003e \u003c%Task_Name%\u003e\r\nTASK -\u003e \u003c%TaskInfo%\u003e\r\nRESPONSE-\u003e Duration:\u003c%Duration%\u003e;Error Code:\u003c%Error_Code%\u003e;Reason:\u003c%Reason%\u003e\r\n***\r\n\u003c%END%\u003e\r\nNetwork TraceRoute: http://dmserver.tc/WebReporting/response/trace.aspx?uid=\u003c%UID%\u003e\u003c%ID:\u0027X\u0027%\u003e\r\nHTML Page snapshot: http://dmserver.tc/WebReporting/response/content.aspx?uid=\u003c%UID%\u003e\u003c%ID:\u0027X\u0027%\u003e\r\n”

Test_Message

String

Example:

“Test_Message”: “This is a test alert for device \u003c%Site_Name%\u003e. If you have any questions please contact \u003c%Contact_Full_Name%\u003e”

Uptime_Message

String

Example:

“Uptime_Message”: “Device \u003c%Site_Name%\u003e detected to be back online at \u003c%Monitor_DateTime%\u003e from monitoring location: \u003c%Location%\u003e”

Assigned_To

Array containing int32 values

This array contains list of device ids where alert group was assigned.

Example:

“Assigned_To”: [8533, 8534,9756]

The following actions can be performed with Alert Templates:

Get list of notification templates

GET URI:

/templates
Success Response containing an array of IDs:
[395,394,379]
Get specific notification template info

GET URI:

/template/{template_ID}
Success Response:

{
“Id”: 395,
“Name”: “email template”,
“Subject”: “Monitoring Alert “,
“Email_Reply_To”: “reply@to.com”,
“Template_Type”: “Html”,
“Error_Message”: “Error occured during the device monitoring at \u003c%Monitor_DateTime%\u003e\r\nMonitoring location:\u003c%Location%\u003e\r\n———————————————————–\r\nTask sequence:\r\n\u003c%BAND Responses%\u003e\r\nName -\u003e \u003c%Task_Name%\u003e\r\nTASK -\u003e \u003c%TaskInfo%\u003e\r\nRESPONSE-\u003e Duration:\u003c%Duration%\u003e;Error Code:\u003c%Error_Code%\u003e;Reason:\u003c%Reason%\u003e\r\n***\r\n\u003c%END%\u003e\r\nNetwork TraceRoute: http://dmserver.tc/WebReporting/response/trace.aspx?uid=\u003c%UID%\u003e\u003c%ID:\u0027X\u0027%\u003e\r\nHTML Page snapshot: http://dmserver.tc/WebReporting/response/content.aspx?uid=\u003c%UID%\u003e\u003c%ID:\u0027X\u0027%\u003e\r\n”,
“Test_Message”: “This is a test alert for device \u003c%Site_Name%\u003e. If you have any questions please contact \u003c%Contact_Full_Name%\u003e”,
“Uptime_Message”: “Device \u003c%Site_Name%\u003e detected to be back online at \u003c%Monitor_DateTime%\u003e from monitoring location: \u003c%Location%\u003e”,
“Assigned_To”: [613] }

Create new Notification Template

Notification Template can be created using two methods:

PUT on the following URI : /templates
POST on the following URI: /templates?verb=PUT
PUT / POST Content example (formatted):

{
“Name”: “email template”,
“Subject”: “Monitoring Alert “,
“Email_Reply_To”: “reply@to.com”,
“Template_Type”: “Html”,
“Error_Message”: “Error occured”,
“Test_Message”: “Relax, this is just test message”,
“Uptime_Message”: “Device is back online”,
}

Success Response:

{
“Success”:true,
“Result”:398
}

Edit Notification Template

POST URI:

/template/{template_id}
POST Content example (formatted):

{
“Name”: “email template”,
“Subject”: “Monitoring Alert “,
“Email_Reply_To”: “reply@to.com”,
“Template_Type”: “Html”,
“Error_Message”: “Device: \u003c%Site_Name%\u003e\r\n
Location: \u003c%Location%\u003e\r\n
Error Code: \u003c%Error_Code%\u003e\r\n
Error Description: \u003c%Error_Dscr%\u003e”,
“Test_Message”: “Relax, nothing happened”,
“Uptime_Message”: “Life is good”,
“Assigned_To”: [] }

Success Response:

{
“Success”:true,
“Result”:”Template 398 has been updated”
}

Delete Notification Template

Notification Template can be deleted using two methods:

DELETE on the following URI : /template/{templateid}
POST on the following URI: /template/{templateid}?verb=DELETE
Success Response:

{
“Success”: true,
“Result”: “Template 398 has been deleted”
}