Use the following APIs to create, update, get, and delete notification definitions.

Create a Notification Definition

Required Permissions

You must have the Create Notification Definition permission to perform this operation.

API
/api/notification-definitions
Method
POST
Required Parameters
Name Description
name

string

Name of the notification definition. (Mandatory)
description

string

Description of the notification definition. (Optional)
httpParameters

json

It is mandatory to include one of the following options, but not both:
  • http_parameters
  • email_parameters

If the notification definition's protocol is HTTP, then httpParameters is mandatory.

It includes the following fields:
  • relativePath

    string : The relative API endpoint where the notifications are to be delivered.

  • headers

    json : The list of headers that is expected by the API endpoint.

    • key

      string: Header key.

    • value

      string: Header value.

  • payloadTemplate

    string: The custom REST template for receiving notifications.

retrySchedule

  • retryInterval: The retry interval in milliseconds.
  • maxRetryCount: The maximum number of times to retry.
  • requestTimeout: The response wait time in milliseconds.
sslTlsVersion
  • NO_CERT: Use this option if the REST server is non-TLS.
  • TLS1_2: Use this option if the REST server is TLS.
(Mandatory)

host

Hostname or IP address of the REST server. (Mandatory)

port

Port number of the REST server. (Mandatory)

certificate

Certificate of the REST server.

Mandatory if sslTlsVersion is other than NO_CERT.

authenticationType
  • NO_AUTH: Use this option if the REST server does not require any authentication.
  • BASIC: Use this option if the REST server requires basic authentication.
(Mandatory)

username

User name is mandatory if authenticationType is BASIC.

password

Password is mandatory if authenticationType is BASIC.

emailParameters

json

It is mandatory to include one of the following options, but not both:
  • http_parameters
  • email_parameters
emailParameters is mandatory for sending email notifications.
It consists of the following fields:
  • emailRecipients: Consists of a list of email recipients. It is mandatory to enter at least one recipient.
  • emailSubjectTemplate: Consists of the email subject. You can derive the keys from the Create Default Template API.
  • emailBodyTemplate: Consists of the email body.
  • senderEmailAddress: Consists of the sender's email address.
  • senderName: Consists of the sender's name.
schedule
  • repeatInterval: The repeat interval in milliseconds.
  • maxRepetition: The maximum number of repetitions.
onFailure

string

The definition id for which the instance gets triggered if the notification for the current definition has a FAILED status.
onSuccess

string

The definition id for which the instance gets triggered if the notification for the current definition has a SENT status.
onCompletion

string

The definition id for which the instance gets triggered irrespective of the status of the instance for the current definition.
protocol
  • HTTP

    Use the HTTP protocol to notify to an HTTP REST server.

  • SMTP

    Use the SMTP protocol to notify using Emails

(Mandatory)
Input Example for HTTP Notification Definition
{
"name": "REST",
"description": "REST Definition",
"protocol": "HTTP",
"httpParameters": {
"headers": [{
"key": "Content-Type",
"value": "application/json"
}],
"relativePath": "/basicauth/notification",
"retrySchedule": {
"retryInterval": 120000,
"maxRetryCount": 5,
"requestTimeout": 5000
},
"sslTlsVersion": "TLS1_2",
"host": "10.5.103.137",
"port": 9403,
"certificate": "-----BEGIN CERTIFICATE-----
MIIDcTCCAlmgAwIBAgIEXO9mujANBgkqhkiG9w0BAQsFADBwMQswCQYDVQQGEwJJ
TjESMBAGA1UECAwJS2FybmF0YWthMRIwEAYDVQQHDAlCZW5nYWx1cnUxDzANBgNV
BAoMBlZNd2FyZTESMBAGA1UECwwJUHVsc2UgSW9UMRQwEgYDVQQDDAtNb2NrIFNl
cnZlcjAeFw0xOTA1MzAwNTE0MzRaFw0yMDA1MjkwNTE0MzRaMHAxCzAJBgNVBAYT
AklOMRIwEAYDVQQIDAlLYXJuYXRha2ExEjAQBgNVBAcMCUJlbmdhbHVydTEPMA0G
A1UECgwGVk13YXJlMRIwEAYDVQQLDAlQdWxzZSBJb1QxFDASBgNVBAMMC01vY2sg
U2VydmVyMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA3YnPOFGEN3c7
6 Zu5UPyhZf / +fv8LS0xVs6jqZ1PP8ra1ZNvJUTd10gih4WdHDGUm6 / 35 OzfWQyYT
Z2RtTl + gnaw / 6 Ti3IUp / yrE0mqWa6AlR + i3CsETO7YA5o31M86fmVyvB8NyTqrqw
yZ7ufuJd12TPnl7ZiBNLAavowJ5i8YUwXOpvwyYLV8HXQ / B4ljv8Zdpn0tex0AzE +
sgYVd7S1CtPwh4ozy4Xig8Yow5MkAAwNMcuPBkE7LtqHu + Sez6JUCsRkZxJhiLL
gUUuJw9DdhyMZDR7Eqsd7 / KiAqlQ9StoZDjpED1HWIiq6LRZDZwpLFaG / ixzfXZ +
x1trMy0 / eQIDAQABoxMwETAPBgNVHREECDAGhwQKBWeJMA0GCSqGSIb3DQEBCwUA
A4IBAQAKcJlyE6tQBpSoVW2GqTVm93 / Z3 / f4QZreAIUogJsCOO / ZBbED6WrpKFLO
QZGOmr4q9i09w0IeWP6P2yL2KImfQsn9D + LpreA10h7Lz6a9b / 0 icSpgeHP1dBII
BsK3tFG2VlCHP0W / h7fnOAlUeoZlYy / WWxrAtTnS5cmX4cNaeI6441zUZdB3kYHS
XKEFnNZVFa4weJb + cR84gB6xy5gsFaz8y3X40jxYNq4VuML + k4iprrV86mlX6BIH
rM2MRYnpjm8j9MCuqrBmUOadKDu6PSUQ8IEhsH2IDXNIAJWBNO6MnneLaxKge1 / s
46 bChTVzwk2uwH + RGQOkTqLkqUYj
-- -- - END CERTIFICATE-- -- - ",
"authenticationType": "BASIC",
"username": "root",
"password": "VMware1!"
},
"onSuccess": "61871b1f-3d33-4203-a6b3-880d2b4e5a1a",
"onFailure": "61871b1f-3d33-4203-a6b3-880d2b4e5a1a",
"onCompletion": "61871b1f-3d33-4203-a6b3-880d2b4e5a1a"
}
Input Example for SMTP or Email Notification Definition
{
"name": "Email",
"description": "Email Definition",
"protocol": "SMTP",
"emailParameters": {
"senderEmailAddress": "[email protected]",
"senderName": "svc.pulse-notify",
"emailSubjectTemplate": "Notification for Alert ${alertState}",
"emailRecipients": [
"[email protected]"
],
"schedule": {
"repeatInterval": 120000,
"maxRepetition": 5
}
}
}
Response
{
  "id": "5bf29d8178d80c88c89df352"
}

Get Notification Definition

Required Permissions

You must have the View Notification Definition permission to perform this operation.

API
/api/notification-definitions/{id}
Method
GET
Required Parameters
None
Sample Response
{
  "id": "5bf29d8178d80c88c89df352",
  "name": "SampleHttpNotificationDefinition",
  "description": "This is a sample notification definition",
    "httpParameters": {
    "relativePath": "/callback",
    "headers": [
      {
        "key": "Content-Type",
        "value": "application/json"
      }
    ]
  },
  "retryCount": 2,
  "tenantId": "5beaa559a40a82f457340c4d",
  "createdTime": "1542470980533",
  "lastUpdatedTime": "1542470980533",
  "createdBy": "[email protected]",
  "lastUpdatedBy": "[email protected]",
  "updateVersion": 1
  "payloadTemplate": "{\"description\" : \"${description}
  \",\"deviceTemplateId\" : \"${deviceTemplateId}\",\"deviceId\" : \"$
  {deviceId}\",\"triggerCount\": \"${triggerCount}\"}"
     }
  }

Update Notification Definition

Required Permissions

You must have the Edit Notification Definition permission to perform this operation.

API
/api/notification-definitions/{id}
Method
PUT
Required Parameters
Name Description
id

string

Notification definition ID. (Mandatory)
name

string

Name of the notification definition. (Optional)
description

string

Description of the notification definition. (Optional)
httpParameters

json

If the notification definition's protocol is HTTP, then httpParameters is mandatory.

You cannot edit the protocol type.

It includes the following fields:
  • relativePath

    string : The relative API endpoint where the notifications are to be delivered.

  • headers

    json : The list of headers that is expected by the API endpoint.

    • key

      string: Header key.

    • value

      string: Header value.

  • payloadTemplate

    string: The custom REST template for receiving notifications.

retrySchedule
  • retryInterval: The retry interval in milliseconds.
  • maxRetryCount: The maximum number of times to retry.
  • requestTimeout: The response wait time in milliseconds.
sslTlsVersion
  • NO_CERT: Use this option if the REST server is non-TLS.
  • TLS1_2: Use this option if the REST server is TLS.
(Mandatory)

host

Hostname or IP address of the REST server. (Mandatory)

port

Port number of the REST server. (Mandatory)

certificate

Certificate of the REST server.

authenticationType
  • NO_AUTH: Use this option if the REST server does not require any authentication.
  • BASIC: Use this option if the REST server requires basic authentication.
(Mandatory)

username

User name is mandatory if authenticationType is BASIC.

password

Password is mandatory if authenticationType is BASIC.

emailParameters

json

You cannot edit the protocol type.

emailParameters is mandatory for sending email notifications.
It consists of the following fields:
  • emailRecipients: Consists of a list of email recipients. It is mandatory to enter at least one recipient.
  • emailSubjectTemplate: Consists of the email subject. You can derive the keys from the Create Default Template API.
  • emailBodyTemplate: Consists of the email body.
  • senderEmailAddress: Consists of the sender's email address.
  • senderName: Consists of the sender's name.
schedule
  • repeatInterval: The repeat interval in milliseconds.
  • maxRepetition: The maximum number of repetitions.
onFailure

string

The definition id for which the instance gets triggered if the notification for the current definition has a FAILED status.
onSuccess

string

The definition id for which the instance gets triggered if the notification for the current definition has a SENT status.
onCompletion

string

The definition id for which the instance gets triggered irrespective of the status of the instance for the current definition.
Input Example for HTTP Update Notification Definition
{
    "name": "SampleHttpNotificationDefinition",
    "description": "This is a sample HTTP Notification Definition",
        "httpParameters": {
        "headers": [{
            "key": "content-type",
            "value": "application/json"
        }],
        "relativePath": "/basicauth/notification",
        "retrySchedule": {
            "retryInterval": 5000,
            "maxRetryCount": 1,
            "requestTimeout": 5000
        }
    },
    "onFailure": "b6ece001-88d6-4300-aca8-9d515fd906c8",
    "onSuccess": "7024eb44-b5ec-47c0-9264-51015a2917a6",
    "onCompletion": "7024eb44-b5ec-47c0-9264-51015a2917a6"
}
Input Example for SMTP Update Notification Definition
{
    "name": "SampleSmtpNotificationDefinition",
    "description": "This is a sample Smtp Notification Definition",
        "emailParameters": {
        "senderEmailAddress": "[email protected]",
        "senderName": "Sample name",
        "emailRecipients": [
            "[email protected]"
        ],
        "schedule": {
            "repeatInterval": 0, //Time in milliseconds
            "maxRepetition": 0 //Time in milliseconds
        }
    }
}

Response
{
  "id": "5bf29d8178d80c88c89df352"
}

Delete Notification Definition

Required Permissions

You must have the Delete Notification Definition permission to perform this operation.

API
/api/notification-definitions/{id}
Method
DELETE
Required Parameters
Name Description
id

string

Notification definition ID.
Response
{}

List All Notification Definitions

Required Permissions

You must have the View Notification Definition permission to perform this operation.

API
/api/notification-definitions
Method
GET
Required Parameters
None
Response
{
  "notificationDefinitions": [
    {
      "id": "5bf29d8243d80c88c25an910",
      "name": "SampleSmtpNotificationDefinition",
      "description": "This is a sample notification definition",
        "emailParameters": {
        "emailRecipients": [
          "[email protected]",
          "[email protected]"
        ],
      "senderEmailAddress": "[email protected]",
        "senderName": "User 3",
        "emailSubjectTemplate": "Notification for Alert ${alertState}",
        "emailBodyTemplate": "<html lang=\"en\"> Notification for alert ${alertDefinitionId} </html>"
      },
      "tenantId": "5beaa559a40a82f457340c4d",
      "createdTime": "1542626689123",
      "lastUpdatedTime": "1542626689123",
      "createdBy": "[email protected]",
      "lastUpdatedBy": "[email protected]",
      "updateVersion": 1
    },
    {
      "id": "5bf29d8178d80c88c89df352",
      "name": "SampleHttpNotificationDefinition",
      "description": "This is a sample notification definition",
        "httpParameters": {
        "relativePath": "/callback",
        "headers": [
          {
            "key": "Content-Type",
            "value": "application/json"
          }
        ],
      "payloadTemplate": "{\"description\" : \"${description}
      \",\"deviceTemplateId\" : \"${deviceTemplateId}\",\"deviceId\" : \"$
      {deviceId}\",\"triggerCount\": \"${triggerCount}\"}"
      },
      "retryCount": 1,
      "tenantId": "5beaa559a40a82f457340c4d",
      "createdTime": "1542622551030",
      "lastUpdatedTime": "1542622551030",
      "createdBy": "[email protected]",
      "lastUpdatedBy": "[email protected]",
      "updateVersion": 1
    }
  ],
  "pageInfo": {
    "page": 1,
    "pageSize": 10,
    "totalElements": "2",
    "totalPages": "1"
  }
}

Get Template

API
/api/notification-templates
Method
GET
Required Parameters
type. For example, /api/notification-templates?type=default
Response
{
   "templateKeys": [
      {
         "key": "entityType",
         "description": "Entity type like Alert, campaign for which notification is generated"
      },
      {
         "key": "alertSeverity",
         "description": "Alert severity defined in the alert definition."
      },
      {
         "key": "triggersMetricName",
         "description": "Metric name for which alert was triggered"
      },
      {
         "key": "description",
         "description": "Description of alert"
      },
      {
         "key": "recommendation",
         "description": "Defined in alert definition who takes remediation steps for user"
      },
      {
         "key": "entityId",
         "description": "Id of the generated alert"
      },
      {
         "key": "alertTemplate",
         "description": "Alert template selected by user"
      },
      {
         "key": "notificationInstanceId",
         "description": "Id of notification instance created for this alert"
      },
      {
         "key": "deviceId",
         "description": "Device Id for which alert is generated"
      },
      {
         "key": "triggersTimeMs",
         "description": "Time for which alert was triggered"
      },
      {
         "key": "triggerCount",
         "description": "No of times metric exceeded the threshold which results in triggering alert"
      },
      {
         "key": "duration",
         "description": "Duration (in sec) of absence of metrics from offline alert triggering device"
      },
      {
         "key": "lambda",
         "description": "Threshold value for triggering alert"
      },
      {
         "key": "cancelCount",
         "description": "Count of consecutive ingestion on which the alert cancellation will take place"
      },
      {
         "key": "entityState",
         "description": "Present state of the entity like active, user_acknowledged etc"
      },
      {
         "key": "entityName",
         "description": "Entity name for which notification is generated"
      },
      {
         "key": "deviceTemplateId",
         "description": "ID of device template"
      },
      {
         "key": "createdTime",
         "description": "Time at which alert was created"
      },
      {
         "key": "lastUpdatedTime",
         "description": "Last time when alert was updated"
      },
      {
         "key": "metrics",
         "description": "List of metrics on a threshold alert symptom"
      },
      {
         "key": "alertDefinitionId",
         "description": "alert definition id"
      },
      {
         "key": "triggersValue",
         "description": "The value which caused the triggering of alert"
      },
      {
         "key": "userAcknowledged",
         "description": "User who acknowledged the alert"
      }
   ],
   "subject": "${entityType} ${entityState} Notification for ${entityType} ${entityName}(${entityId})",
   "default.alert.body.template": "<html lang=\"en\"> <head> <meta charset=\"UTF-8\"> <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\"> <meta http-equiv=\"Content-Type\" content=\"text/html\"> <link rel=\" stylesheet\" href=\"https://unpkg.com/[email protected]/clarity-ui.min.css\"> </head> <body style=\"word-wrap:break-word;-webkit-nbsp-mode:space;color:rgb(0,0,0)\"> <div xmlns=\"http://www.w3.org/1999/xhtml\" lang=\"en\"> <style type=\"text/css\" media=\"all\"> @font-face { font-family: 'subjectFont'; src: url('https://console.cloud.vmware.com/csp/gateway/portal/assets/fonts/Metropolis/Metropolis-Light.otf') format('opentype'); src: url('https://console.cloud.vmware.com/csp/gateway/portal/assets/fonts/Metropolis/Metropolis-Light.ttf') format('truetype'); src: url('https://console.cloud.vmware.com/csp/gateway/portal/assets/fonts/Metropolis/Metropolis-Light.woff') format('woff'); src: url('https://console.cloud.vmware.com/csp/gateway/portal/assets/fonts/Metropolis/Metropolis-Light.woff2') format('woff2'); font-weight: normal; font-style: normal; } @font-face { font-family: 'bodyFont'; src: url('https://console.cloud.vmware.com/csp/gateway/portal/assets/fonts/Metropolis/Metropolis-Regular.otf') format('opentype'); src: url('https://console.cloud.vmware.com/csp/gateway/portal/assets/fonts/Metropolis/Metropolis-Regular.ttf') format('truetype'); src: url('https://console.cloud.vmware.com/csp/gateway/portal/assets/fonts/Metropolis/Metropolis-Regular.woff') format('woff'); src: url('https://console.cloud.vmware.com/csp/gateway/portal/assets/fonts/Metropolis/Metropolis-Regular.woff2') format('woff2'); font-weight: normal; font-style: normal; } .wrapper-container { overflow-wrap: normal; background-color: #fafafa; /*gray color*/ } .container { max-width: 600px; margin: 0 auto; background-color: #ffffff; /*white color*/ } .csp-header { font-family: 'subjectFont', Helvetica, Arial, sans-serif; font-size: 23px; padding: 24px