We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

How to use POST method URL in InvokeHTTP processor

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 “UpdateAttributeprocessor 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:

Article ID: Published Date: Last Revised Date: Platform: Control:
8031 10/09/2017 10/09/2017 Big Data Platform General
Did you find this information helpful?
Add Comment
You must log in to leave a comment

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.