Created 03-21-2023 04:11 AM
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.
Created on 03-21-2023 05:46 AM - edited 03-21-2023 05:48 AM
@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.
Created 03-21-2023 05:57 AM
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?
Created 03-21-2023 06:10 AM
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.
Created 03-21-2023 06:16 AM
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