getViaRest
A Workflow Engine function that performs a GET request to a configured REST endpoint with an optional set of query parameters and stores the response in workflowContext.values.<endpointName>.
This function supports in-memory caching to reduce repeated requests for the same data. Cached entries are time-bound (default: 300 seconds) and limited to 1,000 items. When the limit is reached, the oldest entry is removed using a First In, First Out (FIFO) policy.
Caching is enabled only when both the namespace and key parameters are provided.
The function checks the configured namespace for the specified key.
If a cached entry exists, the cached data is copied to
workflowContext.values.<endpointName>as though the request had completed successfully.If no cached entry exists, the GET request is executed. If successful, the response data is cached in the configured namespace using the specified key.
Cache expiration is determined as follows:
If cacheTTL is configured, that value is used as the cache Time-To-Live (TTL).
If cacheTTL is not configured, a default TTL of 300 seconds (5 minutes) is used.
When cached data is returned, spoofed request and response details are added to the workflow context under the
requestStatusandresponseCodes.<endpointName>keys, as though the request had completed successfully (for example:).{ "requestStatus": { "status": "success", "status_code": 200, "status_msg": "OK" }, "responseCodes": { "testEndpoint": 200 } ... }
This function is available as a feature of the Add-ons v2.7 download and later.
This function is available for event, alert, and Situation workflows.
Back to Workflow Engine Functions Reference.
Arguments
Workflow Engine function getViaRest takes the following arguments:
Name | Required | Type | Description |
|---|---|---|---|
| yes | string | The name of the REST endpoint configured on the Integrations page (must use the GET protocol). |
| yes | string | The name of the payload map configured on the Integrations page. The map is used to populate request parameters for the REST endpoint. |
| no | string | Overrides the configured endpoint URL. This can be used to construct a URL dynamically, for example by using CEvent substitution. |
| no | string | The namespace used for caching. |
| no | string | The key used within the caching namespace. This value supports substitution. Avoid using values that vary between CEvents that are expected to use the same cache entry. For example, do not use |
| no | number | The cache Time-To-Live (TTL) in seconds. The default value is 300 seconds (5 minutes). |
getViaRest stores the response data in workflowContext.values.<endpointName>.
Example
The following example demonstrates typical use of Workflow Engine function getViaRest.
The getViaRest function downloads the results under workflowContext.values.<endpointName>. You can use subsequent actions such as:
copyFromContextto copy results fromworkflowContext.values.<endpointName>tocevent.custom_info.<KEY>.mergeListto condense results from different endpoints under single field either workflowContext or custom_info, for example:from
workflowContext.values.RESTEndpoints1,workflowContext.values.RESTEndpoints2toworkflowContext.values.mergedListor,
from
custom_info.enrichment.RESTEndpoints1,custom_info.enrichment.RESTEndpoints2tocustom_info.enrichment.restreduceObjectsListto reduce a list of similar objects to single object. You can apply this function to either workflowContext or custom_info fields, such ascustom_info.enrichment.RESTEndpoints1orworkflowContext.values.RESTEndpoint1.