Consuming REST API in Boomi
In this blog, let us discuss about how to consume REST service.
- To consume REST services in Boomi, we have a connector called “HTTP Client” through which we can use the service provided by third party API.
- Here, we want to access particular employee data from third party API where we give employee id as an input and will fetch complete data of an employee as the response.
Now, let us see the steps of “how to consume REST service”.
Step 1: Firstly, create a process with a start shape and type http in search map, you will get to see “Http Client” connector.
Step 2: Drag and drop “Http Client” connector onto the process canvas and place it after the start shape.
Step 3: Now, we have to configure 3 things in the connector i.e., Action, Connector and Operation.
Step 4: If we look at the Action, we find two operations i.e Get and Send. If we are sending data to an API, we will use send operation. In this example, we are going to get the records of an employee. Therefore, consider Action as Get.
Step 5: To configure the connection, click + and give a relevant name to the connection. You see 2 parts in the connection tab i.e., URL and Authentication type.
- In place of URL, give base URL of an Api for which you want to consume the service.
- Based on the authentication type provided by the third-party Api, we have to choose the field. We are going to leave it as none which is default (as we don’t have any authentication)
- You can optionally configure client certificate authentication i.e., SSL options based on the certificate provided by the third party.
- Click on save and close.
Step 6: Now, click on + to configure the operation and give a relevant name.
In options tab, we find connector action as GET by default as we have configured GET in the connector.
- Select request and response profiles based on the data that is being sent and received by the connector. we will put both request and response profiles as NONE as we don’t need any request or response profiles to access the API as we would only want records to be retrieved.
- Content type describes the format of how data is represented. In this example, it is application/Json.
- HTTP Method defines the type of request. In this case, it would be GET as we want the employee records to be fetched.
Step 7:
- If you scroll down, you will find Request Headers where you can add the headers which are required to access the API. In this case, we don’t have any headers.
- Next, place the resource path i.e. (add the path which is after the base path).
- For suppose, the URL which we are going to access is http://dummy.restapiexample.com/api/v1/employee/{id}. So, http://dummy.restapiexample.com becomes the base path and “Api/v1/employee/” will be added to the resource path and id would be a dynamic value defined in the shape’s Parameters tab that replaces the resource path value.
- The value would be replaceable only if we check the parameter as shown below.
Click save and close.
Step 8: Now, to assign value to the replacement variable (which is id in this example), we should click on “HTTP Client” connector and go to parameters tab.
Step 9: Now, set the value by hitting + button and you see parameter value with 3 options i.e Input, Type and Static Value. Choose input and you will automatically see id as input as you have declared it to be a replacement variable in the resource path. Give Type as static and static value would be any employee id (In this case, the value is 12)
Step 10: Now, test the process and check for the response.