Articles in this section
Category / Section

How to use POST method URL in InvokeHTTP processor

2 mins read

Introduction:

This document explains the steps required to use POST method Rest API in InvokeHTTP processor.

List of processors required:

Processor

Comments

GenerateFlowFile

Generate empty flowfile content

UpdateAttribute

Updates the attributes for a flowfile

ReplaceText

Updates the content of a flowfile with matched attribute value

InvokeHTTP

Executes POST method Rest API to get response.

 

Overview:

To process POST method Rest API in InvokeHTTP processor, we must pass the POST method body message as flowfile to InvokeHTTP processor. In this sample, GenerateFlowFile generates empty flowfile. UpdateAttribute processor process the generated flowfile and update the user given attribute for the flowfile. Then ReplaceText processor replaces the flowfile content with given attribute value. Then InvokeHTTP processor will execute POST method Rest API from incoming flowfile content.

 

Steps:

Step 1: Drag and drop the GenerateFlowFile processor into workarea. Double click on this processor and choose “SETTINGS” tab in Configure dialog. Rename processor name as per your requirement in Name field and choose “SCHEDULING” in Configure dialog. Change “Run Schedule” field as per your need. For example: 1 day, 1 hr, 5 min, 30 sec.

Step 2: Drag and Drop the “UpdateAttribute” processor into the workarea. Double click on this processor and choose “PROPERTIES” tab in Configure dialog. Add new attribute “messagebody” (as per your need) and enter POST API body message as its value using Add button. It will update the given attribute for the created flowfile by using the Attribute Expression Language.

Step 3: Drag and Drop the “ReplaceText” processor into the workarea. Double click on this processor and choose “PROPERTIES” tab in Configure dialog. Change Replacement Value as ${messagebody}. In which, messagebody is the above given attribute name. It will update the content of a flowfile by replacing the section of the content with attribute value.

Step 4: Drag and Drop the “InvokeHTTP” processor into the workarea. Double click on this processor and choose “PROPERTIES TAB” in Configure dialog. Change HTTP Method value as “POST”. Also enter the remote Rest API URL and content type in Remote URL and Content-Type value field. Note: Content-Type defaults to “application/octet-stream”.

Step 5: Once configured all processors, start the workflow.

Flowfile content transferred from ReplaceText processor to InvokeHTTP processor is shown below:

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Please sign in to leave a comment
Access denied
Access denied