Implementing a REST API operation with intermediary processing by using message maps
You can use the Graphical Data Mapping editor to implement a REST API operation. When you create a map for a REST API operation, you can choose to have the map input and output defined automatically from the definitions in the REST API swagger document.
About this task
When you create the map for a Mapping node in a subflow that implements a REST API operation, you can select the option Message map with input and output for REST API operation operation_name. When you select this option, the map is created with the input and output data fully defined by the JSON schema data definitions in the REST API swagger document.
The local environment is automatically added to the map input and any path or query parameters are added under
, ready for you to connect transforms. A Task transform is pre-wired to , to help you locate this information.The map input message body is populated according to the operation request body, and the output message body is populated according to the response body. When the body is defined as a model or JSON array, the map is created with a JSON domain message. When there is no body, or a simple type the map is created with a BLOB domain message.
Ensure that you are aware of the requirements for JSON schema with message maps. For more information, see JSON schema requirements for message maps.
The following procedure describes the steps that you need to follow if you are implementing a REST operation that involves transforming to an intermediary data format as part of its processing. This is the case if your flow contains nodes that use a different message model from the one that is defined in the REST API. In this situation, you need to use a Mapping node at the beginning of the REST API operation subflow and another Mapping node at the end of the subflow. The first Mapping node takes the REST input from the Swagger document and transforms it to an intermediary format to be used by your processing nodes. At the end of the subflow, the second Mapping node is required to transform from the intermediary format to the format required by the REST API operation response.
- Transform from the message format of the REST API operation request to the format of the intermediary processing input (format X)
- Process data using message format X and, when it is completed, return the format of the intermediary processing result (format Y)
- Transform from message format Y to the format required by the REST API operation response.
Procedure
To implement a REST API operation that involves intermediary processing to transform between data formats, complete the following steps: