Support Questions

Find answers, ask questions, and share your expertise
Announcements
Celebrating as our community reaches 100,000 members! Thank you!

How to send a POST API request in Apache NIFi

avatar
Explorer

I have NiFi pipeline which get data from a csv and transform into a JSON. Then I want to send a post API request from the JSIN created.
I need help setting up the InvokeHTTP processor in NiFi. 
API authorization is using an API key. I need assitance of how to define the api keys, url and JSON body inside InvokeHTTP processor

bhadraka_0-1687508157896.png

 

1 REPLY 1

avatar

@bhadraka Check out this flow definition example for how to prepare and test JSON ahead of an invokeHttp post.  

Screen Shot 2023-06-23 at 9.03.51 AM.png

Flow Def File:

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

 

 

As far as the post itself goes.  I highly recommend that you test API calls with something like Postman so that you can clearly test what headers and such are required so that the API call works.  Only then try to make it work with InvokeHttp duplicating all headers.     Figuring out how to get the call to work and how to configure InvokeHTTP at same time is not fun.

TIP:  in Invoke HTTP click the + to add key value pairs corresponding to your headers or values you need to pass.