Call a REST API using the RESTAsyncRequest node


Learn how to use a RESTAsyncRequest node to call a REST API and a RESTAsyncResponse node to receive the response.
OVERVIEW

This tutorial demonstrates how a RESTAsyncRequest node and a RESTAsyncResponse node can be used to call a REST API and receive the response back asynchronously on a separate thread. A simple application has been created, which contains two message flows. The first flow receives XML data over HTTP (using an HTTPInput node). The XML data is parsed and passed to a RESTAsyncRequest node. The RESTAsyncRequest node's properties specify where the REST API is running (in this tutorial this will be your localhost), and the Request parameter to send. The REST API implements a GET operation, in which a graphical data mapping node is used to 'retrieve' information (actually the values are hard coded in a map) about a user based on the input data. A RESTAsyncResponse node in the second message flow receives the REST API response and transmits it to the HTTPReply node.

In IBM Integration Bus, an application is a container for all the resources that are required to create a solution. An application can contain IBM Integration Bus resources, such as flows, message definitions, libraries, and JAR files. In this tutorial, an application is used to hold the message flow which contains the RESTRequest node. A referenced shared Library is used, to hold an XML schema to describe the input data and a Swagger file to describe the interface of the REST API which is invoked.

This tutorial takes approximately 5 minutes.
Tutorial Topics
  • RESTAsyncRequest node
  • Calling a REST API using the RESTAsyncRequest node
  • Transformation using graphical data mapping
Learning outcomes
  • Understand how to use the RESTAsyncRequest Node to call a REST API.