Support Questions

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

How to invoke api of Content-Type multipart/form-data using invokehttp processor in nifi

avatar
Explorer

Hi Team,

 

How to invoke api of Content-Type multipart/form-data using invokehttp processor in nifi.

It's not working for me. 

 

If anyone has used the same, can you please share.

Thank you.

4 REPLIES 4

avatar

@Techie123 to add headers in invokeHttp just click the + sign to add a new dynamic property, and set key to "Content-Type" and value to "multipart/form-data".   You will also need to make sure the rest of your invokeHttp is confirmed correctly. 

Depending on your version, you can also create and send an attribute called "Content-Type" of the same value.  Newest versions of NiFi will see a default property "Request Content-Type" which can also be set to attribute $mime-type which you can also define to suit your API.  

 

One other suggestion,  make sure you are testing remote API Calls with something like postman to confirm all the required values.   Then, work with NiFi after you have a known operational understanding for the api.

avatar
Explorer

Hi @steven-matison ,

 

I am using the same. I need to upload the file using this method. And also order of dynamic properties important. You know, have can i achieve it?

avatar

The file you need to send or upload to the api, should be the content of your flowfile that routes into InvokeHttp.   So some upstream process should read the file, and send the content through success relationship to InvokeHttp.   For example if this file is json,  I use GenerateFlowFile processor, put the json contents in there, then send to InvokeHttp.

avatar
Explorer

Yes, I am doing the same. And how to maintain the order of the dynamic properties in Invokehttp processor as the order is also important else it is saying bad request. Whenever i am adding those, these are automatically arranging the alphabetical orders instead the order on which i am adding