Configuring mapping for discovery connector request nodes

Discovery connector request nodes provide a JSONata mapping capability, which you can use to map data between nodes in a message flow without needing a separate transformation node in the flow.

About this task

You can use the built-in mapping capability in the discovery connector request nodes to map data in JSON format, by setting static values or configuring JSONata expressions on the node. For example, you can create a flow that takes the output of a GitHub Input node and uses it as input to a Slack Request node by mapping the data between the two nodes. The Slack Request node uses the response schema from the GitHub Input node as input to a map that is used to construct the message that is passed to Slack.

In versions of IBM® App Connect Enterprise prior to V12.0.10, you would add a transformation node (such as a Mapping, JavaCompute, or ESQL Compute node) to the flow in between the GitHub Input and Slack Request nodes. You would use the transformation node to select the data from the GitHub Input node that you want to use for constructing the message to be passed to the Slack Request node for processing.
This image shows a flow containing a GitHub Input node, a Mapping node, and a Slack Request node.

In this example, the Mapping node uses the response schema that is generated automatically by the GitHub Input node and the request schema that is generated by the Slack Request node. You use these schemas to create your map and configure the parts of the message from the GitHub Input node that you want to use as input to the Slack Request node.

In IBM App Connect Enterprise 12.0.10 (and later versions), you can map data between nodes by using the JSONata mapping capability that is provided by the discovery connector request nodes. In this example, you can create a flow containing a GitHub Input node and a Slack Request node, and use mapping during connector discovery to construct the message that you want to pass to the Slack Request node for processing.
This image shows a flow containing a GitHub Input node and a Slack Request node.

You use JSONata mapping during connector discovery to build the input message by configuring the Map Inputs table in the Request tab of the node. You use this table to specify information about the data locations and schemas of the input data that can be used when building the message. After you have configured the connection details for the connector in the Connector Discovery wizard, a panel is displayed in which you can configure the request properties and the payload fields. You can populate these fields either by setting static values or by using a JSONata expression to select input data from any of the available inputs that are configured in the Map Inputs table.

The entries in the Map Inputs table describe specific parts of the message assembly and the schemas that define them:
  • Input name is the unique name for the row in the map inputs table.
  • Input location specifies the location in the message assembly.
  • Message domain specifies the parser for the input location.
  • Schema location specifies the JSON schema that describes the message at the input location.
  • Schema root specifies the location in the schema file that describes the message structure. This is required only if the JSON schema is not at the root of the schema document.

By default, the Map Inputs table contains data that describes a generic input message and the structured parts of the local environment tree. You can add an entry to the table to specify the location of a message in the message assembly that is described by an associated JSON schema. If there is a preceding message flow node that defines the structure of a JSON message arriving on this node's input terminal, the schema is located and suggested as an option that you can use.

If the connector request requires a message body, a Controls field is displayed in the Connector Discovery wizard. This field is visible only for actions that require a message body, such as CREATE, UPDATE, or UPSERT; it is not applicable to actions that do not require a message body, such as RETRIEVEALL and DELETEALL. You use this field to select how you want to populate the fields in the target application. You can choose either Define mappings below or Use input message unchanged:
  • Select Define mappings below to define the mappings in the Connector Discovery wizard. This option is selected by default. You use the fields in the Populate the target fields... section to define your mappings.
  • Select Use input message unchanged to take the input message that was constructed by a transformation node earlier in the flow, such as a Mapping node, an ESQL Compute node, or a JavaCompute node.

When you are adding your JSONata expressions, you can use the Data viewer (in the panel on the left side of the window) to view the available mappings and edit sample data.

For an example of how to configure a discovery connector request node to use JSONata mapping, see JSONata mapping example.

For more information about using JSONata functions and mapping data, see the following topics in the IBM App Connect Enterprise as a Service documentation:
For demonstrations of how to configure discovery connector request nodes to use JSONata mapping and how to access trees in the message assembly using JSONata mapping, see the following videos: