REST Notification

The foglamp-notify-rest delivery notification plugin allows messages to be delivered to a configured REST Server URL.

During the creation of notification instance, you will get the following configuration page, select the REST action to be executed, and provide the URL, REST headers and payload (except for GET & DELETE).

The configuration of the delivery plugin is divided into a number of tabs

Connection

A number of configuration items that relate to the connection to the REST endpoint.

rest_01

  • REST headers : Header information for HTTP REST method, should be in JSON format, default

    {
            "Content-Type": "application/json"
    }
    
  • Connection Timeout : Timeout defined for HTTP Requests, No timeout if set to 0, default 10 seconds.

  • SSL Mode : SSL Mode specifies whether the server requires clients to present a valid certificate to connect to it. Server instances allow clients to connect to it with or without providing a valid certificate. For self-signed certificate enabled REST server, SSL Mode can be set to Off to disable verifying SSL. Options : On/Off

  • Proxy : URL for the proxy, if any.

General

Some general settings for the plugin that apply to both the calls made when then notification has triggered or cleared.

rest_02

  • Enabled: Determines if delivery is enabled or not.

  • Authentication Method: Authentication Method required for logging into the REST server, Options: None/Basic, No Username/Password required if None.

  • Username: Login Username for REST server.

  • Password: Login password for REST server.

On Clear

The On Clear tab defines the details of the REST call that is made when the reason for the delivery is that the notification has trigger, i.e. the condition that is being monitored was previously met but no longer is.

rest_03

  • URL : The URL of the REST server to which the message is required to be sent. Leaving this empty will cause the same URL as the On Trigger URL to be called.

  • method : HTTP REST method e.g. GET/POST/PUT/DELETE/PATCH or the same as the On Trigger method.

  • Payload : Payload information for HTTP REST Payload, should be in JSON format.

    This allows for the following macros substitution:

    • $NOTIFICATION_INSTANCE_NAME$

    • $REASON$

    • $MESSAGE$

On Trigger

The On Trigger tab defines the details of the REST call that is made when the reason for the delivery is that the notification has trigger, i.e. the condition that is being monitored has been met.

rest_04

  • REST URL : The URL of the REST server to which the message is required to be sent.

  • REST method : HTTP REST method e.g. GET/POST/PUT/DELETE/PATCH

  • REST Payload : Payload information for HTTP REST Payload, should be in JSON format, default

    {
            "Sent/Triggered by": "$NOTIFICATION_INSTANCE_NAME$",
            "Reason": "$REASON$",
            "Message": "$MESSAGE$",
            "Custom Text": "any random text...."
    }
    

    This allows for the following macros substitution:

    • $NOTIFICATION_INSTANCE_NAME$

    • $REASON$

    • $MESSAGE$

  • Enable the plugin and click Next

  • Complete your notification instance setup

When the notification rule triggers a new HTTP Request Message will be sent to the configured URL.