Support Questions

Find answers, ask questions, and share your expertise

NiFi InvokeHTTP POST request authenticate via api key and send json input in request body

avatar
New Contributor

Hi Team, I require to pass the json created via JoltTranformJSON into the InvokeHTTP call as the body of the rest api post request, require to authenticate the api call via api key (need to send in the header) and need to get the api call response into a variable in Nifi 1.21.0. Can someone please help on this ? 

madhs_2-1687754183966.png

 

madhs_1-1687753731923.png

 

Thank you

4 REPLIES 4

avatar
Community Manager

Welcome to the community @madhs@stevenmatison is this something you can provide clarity on?


Cy Jervis, Manager, Community Program
Was your question answered? Make sure to mark the answer as the accepted solution.
If you find a reply useful, say thanks by clicking on the thumbs up button.

avatar
Super Collaborator

Use an UpdateAttribute processor to add attributes with your header values. i.e. Content-Type with value of application/json and in the InvokeHTTP you'll notice there's a field called Attributes to Send (or something like this... They will be the headers) and list those Accept|Authorize|Any other (it's regular expression so you might have to escape some characters). FlowFile content should be sent as the body. 

 

joseomjr_0-1687794448675.png

 

joseomjr_1-1687794491980.png

 

avatar

@madhs @joseomjr A great example of the configuration is above.

 

Here is a full flow definition file/example showing how to get values from JSON and prepare ahead of an InvokeHTTP processor:

 

stevenmatison_0-1687795470750.png

 

Flow Def File:

https://raw.githubusercontent.com/cldr-steven-matison/NiFi-Templates/main/InvokeHttp_Demo_2.json

avatar
Community Manager

@madhs  Have you resolved your issue. If so, please mark the appropriate reply as the solution, as it will make it easier for others to find the answer in the future. 

 

 

 

Screen Shot 2019-08-06 at 1.54.47 PM.png

 

 


Cy Jervis, Manager, Community Program
Was your question answered? Make sure to mark the answer as the accepted solution.
If you find a reply useful, say thanks by clicking on the thumbs up button.