Call Rest API

This handler (com.rierino.handler.RestAPIEventHandler) provides ability to make REST based calls to other internal or external services and return their results for API-based integrations.

Handler Parameters

This handler requires no parameters. Instead, target rest system referred to by name using 'domain' field defines the base URL and credentials for all calls. This cacheable.

Actions

CallRest

Makes a REST call and returns the result. Event metadata fields applicable for this action are as follows:

Field
Definition
Example
Default

domain

Name of the system to make REST call to (url and auth parameters of this system are used)

erp

-

inputElement

Json path for the input in request event payload

parameters

-

outputElement

Json path for the output in response event payload

$.product

-

With event metadata parameters as:

Parameter
Definition
Example
Default

inputPattern

JMESPath pattern to apply on data input

{id:parameters.productid}

-

outputPattern

JMESPath pattern to apply on data output, before returning response

{id:id, stock:totalUnits}

-

url

Url path on the target system for REST call

GetInventory

-

urlPath

Payload element to add to the end of REST call url path

parameters.language

-

authPath

Payload element to use for auth.* parameters of REST system

parameters.auth

-

method

Call method to use

POST

GET

contentType

Content type for REST calls (none, query, application/json, application/xml, text/xml, text/plain, multipart/form-data, application/x-www-form-urlencoded)

application/xml

application/json

headers

Json string defining list of headers to add to the request

{"content-encoding":"br"}

-

query.*

Query parameters to pass on the request URL

language=en-US

-

Example

Input

{
    "parameters": {
        "measures": "Population"
    }
}

Event Metadata

For contentType = "multipart/form-data", files can be added as fields using the following fields (all other fields are sent as text fields):

  • $type: Should be set as "FILE"

  • body: Text or JSON body to be sent as file contents

  • fileName: File name to use for sending contents

  • mimeType: Mime-type for the file contents

Example: {"$type": "FILE", "body": {test: true}, "fileName": "test.json"}

Depending on the response format, this handler returns the following data:

Format
Process

json

Response is returned as is

xml

Response is converted to json format

Response is returned as {"text": [text]}

Response is returned as {"html": [html]}

Commands

RECONFIGURE

Reloads all REST target system properties, injecting connection and credential parameters with latest values. Typically used if the base URLs or API credentials change for the target system.

Last updated