Support Questions

Find answers, ask questions, and share your expertise

How to send json body to Apache NiFi InvokeHTTP

avatar
New Contributor

I have an InvokeHTTP processor Apache NiFi, I need to send a curl request with this content

curl https://reqbin.com/echo/post/json
-X POST
-H 'Content-Type: application/json'
-d '{
	"login": "my_login",
	"password":"my_password"
}'

I can't figure out what to do -d

1 REPLY 1

avatar
Super Guru

Hi,

 

The request Body has to be provided as flowfile to the InvokeHttp Processor per the processor description:

 

SAMSAL_0-1685111037806.png

 

You can use an upstream processor to the InvokeHttp like ReplaceText processor to generate the request body a follows:

 

SAMSAL_1-1685111384642.png

 

To send incoming flowfile content as Request Body , make sure the following property of the invokehttp processor is set to true (default):

 

SAMSAL_2-1685111771806.png

 

To make sure you are always getting a response no matter if its successful or not make sure to set the following invokehttp processor to true (default false):

 

SAMSAL_3-1685111869728.png

 

If that helps please accept solution.

Thanks