Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

In NiFi processor 'InvokeHTTP' where do you write body of POST request?

Tags:

apache-nifi

Before posting this question about Apache NiFi InvokeHTTP I have gone through all other questions and their answersbut I am still unsure the best flow I should have. My situation is as below:

1) From Apache Kakfa, I get raw metadata.

2) Using EvaluateJSONPath I get attribute I want.

3) Using RouteOnAttribute I created 3 routes based on the attribute value I got from step-2 above.

4) Now based on the attribute value I want to decide whether I should go for GET or for POST or for Delete.

5) My question is where/how to set POST message? GET message? Delete Message body?

6) I am able to set the URL in configuration part provided by InvokeHTTP. But message body I don't know which is that property? or its in flow file using ReplaceText?

I read somewhere that before you divert your Restful POST HTTP request to InvokeHTTP you must have another processor before which changes the content of flow file.

Ref: Configuring HTTP POST request from Nifi

Please help. Thanks. regards, Yeshwant

like image 883
Yeshwant KAKAD Avatar asked Dec 18 '18 11:12

Yeshwant KAKAD


1 Answers

Adding on to what Bryan had explained, POST will use the FlowFile content as the message body so if you have some other data which you want to wipe/transform into something and then sent as the message body, you can leverage the following processors :

  • ExtractText to read data from the existing FlowFile content
  • ReplaceText to erase the existing content of the FlowFile and replace it with different one

To set the headers for the REST calls, InvokeHTTP has the property Attributes to Send property which takes a regex which will scanned against the incoming FlowFiles' attributes and whichever attributes are matched are taken and sent as HTTP header.

To add new attribute to your existing FlowFile, you can use UpdateAttribute

like image 70
Sivaprasanna Sethuraman Avatar answered Sep 25 '22 08:09

Sivaprasanna Sethuraman