Support Questions

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

NiFi : invokehttp processor - multipart/form-data

avatar
New Contributor

Hello, I m sending a http request to an API and facing some difficulties to configure the multipart specificities.

I have to send 2 files as part of request. Is there any way to send 2 files ? Since there can be only one flow file that is possible 

 

This works fine when one file is being sent. Any help on sending 2 of them ?

 

1 ACCEPTED SOLUTION

avatar
Super Guru

Hi @SushmaNaya ,

I believe this was asked before here but I dont think there is  a way to do it in one shot. you probably have to do it in custom script like executeScript processor where you can have part of the data stored as an attributes (depending how big the part is ) and then the other part is your flowfile content or have both stored as attributes (not recommended). Once you get the flowfile the execute script will get the content of the flowfile and the other aprt form the attribute construct your multi part body and send it that way. By the way if you are using Nifi 2.0 you probably can utilize python extensions to create your own custom processor using pure python when you can use different packages to help you with that. You can find example here: https://community.cloudera.com/t5/Support-Questions/Nifi-1-18-multipart-form-data-with-binary-part-a...

https://www.w3schools.com/python/ref_requests_post.asp

Hope that helps

View solution in original post

2 REPLIES 2

avatar
New Contributor

SushmaNaya_0-1721708871914.png

 

avatar
Super Guru

Hi @SushmaNaya ,

I believe this was asked before here but I dont think there is  a way to do it in one shot. you probably have to do it in custom script like executeScript processor where you can have part of the data stored as an attributes (depending how big the part is ) and then the other part is your flowfile content or have both stored as attributes (not recommended). Once you get the flowfile the execute script will get the content of the flowfile and the other aprt form the attribute construct your multi part body and send it that way. By the way if you are using Nifi 2.0 you probably can utilize python extensions to create your own custom processor using pure python when you can use different packages to help you with that. You can find example here: https://community.cloudera.com/t5/Support-Questions/Nifi-1-18-multipart-form-data-with-binary-part-a...

https://www.w3schools.com/python/ref_requests_post.asp

Hope that helps