Payload-Based Mappings

When the mapping type Payload based is selected, the payload structure is directly defined for the request sent to the external service and the returned response from the external service.

The request and the response contain placeholders expressions that will be replaced at runtime before sending the message to the corresponding web-hook and after receiving the response.

In that case "maps", "expressions", and "constants" are defined directly in the payload structure. The "choices" expressions are defined in a separate structure called switches as explained later in this document.

Simple Complete Example

Below is an example of a structure block defining the request and the response format:

In addition, you can define switches to include conditions:
  • You define the switch definition in the switches block: Each switch has a reference name, a list of cases, and a default value.

  • The defined switch is then referenced with the keyword ${SWITCH} in the structure block, at the location where the switch should be evaluated. It accepts two parameters: the name of the switch and the input field to transform.

  • Nested properties can be referenced using the dot notation. For instance, the input field "tags.serviceType" can be declared as second parameter with the keyword ${SWITCH} and be used to refer to the property "serviceType" located under the property "tags".

  • In a switch, it is also possible to use expressions or embedded switches: for instance, a first switch can refer to a second switch. An example is provided below.

Example with 'SWITCH'

Example with Context Handling

Example with Embedded Switches and Expressions

Template Mechanism

In a payload-based mapping, it is possible to configure templates in order to process array elements in a dynamic way. In a template definition, the format to apply to each element is then defined.

To define a template:
  • You need to put the template definition in the templates block: each template has a reference name and an itemStructure defining the format for each item of the collection.

  • The defined template is then referenced with the keyword ${TEMPLATE} in the structure block, at the location where the template should be evaluated. It accepts two parameters: the name of the template and the input array to process.

  • When the template format is defined, it is possible to refer to any item using the keyword @ITEM. For instance, to refer to the property description of any item, you need to use @ITEM.description.

  • The generated value is an array.

Example with Operations Automation:

Template block:

Structure block: