# sendViaRest

A Workflow Engine function that sends the payload from a createPayload function to an external REST endpoint.

To use this function, you must first configure the following:

• A REST Endpoints integration, which configures the endpoints for this function to use.

• A createPayload function which precedes this function, in order to generate the payloads this function sends.

• For best practice, create a new engine to handle the send process. This is to prevent potential blockages during the send process under load.

If you want to send both alerts and Situations, you must create a separate engine for each workflow. A separate engine has the following moolet characteristics:

standalone_moolet: true
event_handlers: [<if required>]
process_output_of: <place in the moolet chain>

Moogsoft recommends this moolet is single threaded to ensure Moogsoft Enterprise works at the same rate as the receiving API. However, you can modify the thread count if necessary, for example if the endpoint has inherent rate or load mechanics, or ordering. No other moolet should rely on or process the output of this one.

This function is available as a feature of the Workflow Engine v1.2 download and later.

This function is available for alert, enrichment, and Situation workflows.

The workflow sweep up filter applies to this function. If you use the sweep up filter within the workflow, createPayload applies to all the objects in the workflow. Consequently, sendViaRest sends the payload created using all objects within the workflow.

## Arguments

Workflow Engine function sendViaKafka takes the following arguments:

Name

Required

Type

Description

endpointName

Yes

String

Name of the endpoint defined in the REST Endpoints Reference integration.

## Example

The following example demonstrates typical use of Workflow Engine function sendViaRest.

Set the following:

• endpointName: AlertToSend

The UI translates your settings to the following JSON:

{"endpointName":"AlertToSend"}

The function returns true if it was able to locate and successfully send the alert data to the REST endpoint. If it could not find the endpoint configuration, or send the data, the function returns false.