You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@nifi.apache.org by Luis Carmona <lc...@openpartner.cl> on 2020/04/27 17:20:59 UTC

POST multipart/form-data with Invokehttp

Hi everyone,

Hoping everybody is doing ok, wherever you are, need some help please.

Does anyone has sent a file and parameters to a REST point using
Invokehhtp with multipart/form-data as mime-type ?

I can't figure out how to include the -F <parameter>, speaking in terms
of curl syntax.

I really need this done throught NIFIso any help will be highly
apreciated.

Thanks in advance.

LC


Re: POST multipart/form-data with Invokehttp

Posted by Otto Fowler <ot...@gmail.com>.
 ok, i’m sure I can fumble through it,  now that you can full circle inside
a flow

On April 29, 2020 at 15:10:49, Mark Payne (markap14@hotmail.com) wrote:

I would assume that I just used curl to send some multipart/form data and
verified that it properly received the data. But I don’t remember
specifically.

On Apr 29, 2020, at 2:44 PM, Otto Fowler <ot...@gmail.com> wrote:

Mark do you remember what you did to verify
https://github.com/apache/nifi/pull/2991?  Or know of an article?

On April 29, 2020 at 13:40:17, Mark Payne (markap14@hotmail.com) wrote:

Thanks Otto, I think a blog would be hugely helpful. People ask a lot of
times how to do multipart/form uploads. Now we can do it, but people won’t
know until they see a blog telling them. And it means when someone asks we
can just hand them a link :)

-Mark

On Apr 29, 2020, at 1:27 PM, Otto Fowler <ot...@gmail.com> wrote:

Note, I did some revisions based on review, so it is slightly different
than the original submittal.  You’ll want to see it again.  Maybe I’ll
write up a blog if I find some time

On April 28, 2020 at 01:01:14, Otto Fowler (ottobackwards@gmail.com) wrote:

Well it is in review right now, and there will be changes up coming.

On April 27, 2020 at 23:12:21, Luis Carmona (lcarmona@openpartner.cl) wrote:

Hi Otto,

Compiled your version, and It DID WORK !!.

How risky is to use this "version" in a production environment ?

Thanks a lot.

LC




On Mon, 2020-04-27 at 11:05 -0700, Otto Fowler wrote:
> No, Luis, if the PR is accepted and lands, it will be in the next
> released version of nifi after that.
> r/>> If you build nifi yourself, it will be availabllle when you build
> master after it lands. r/>> r/>> On April 27, 2020 at 13:56:36, Luis
Carmona (lcarmona@@@openpartner.cl)
> wrote:
> > Thank you all, r/>> > r/>> > Wesley and Etienne, is there any
documentation source aaabout how to r/>> > connect a script in javascript
to nifi reessources, InputStream, r/>> > OutputStream, Erros, and so on ??
r/>> > r/>> > r/>> > Otto, sure I can give it a try, I am desperate for
thisss solution.
> > What r/>> > you mention means I have to lookkk for a tutorial about
adding a
> > custom r/>> > processor right ??? rr/>&> > r/>> > r/>> > Thanks again,
r/>> > r/>> > LC r/>> > r/>> > r/>> > r/>> > r/>> > On Mon, 2020-04-27 at
14:52 -0300, Wesley C. Dias de Ollliveira
> > wrote: r/>> > > Owh!!! r/>> &>; > br/>> Great, Otto!! r/>> > >
br/>&ggt; GGood news!! r/>> > > br/>> Em seg., 27 de abbr. dee 2020 às
14:50, Ottto Fowler < r/>> > > ottobaackwards@gmail.com> escreveu: r/>> > >
> Whaat good timing, I just did : br/>> >
> > https:://github.com/apache/nifi/pull/4234 r/>> > > > If you can build
and try that would be sweet! or maybe a
> > review! br/>> > br/>> > On April 27, 2020 at 13:45:42, Etienne
> > Jouvin ( < r/>> > > > lapinoujoujouuu@gmail.com) wrote: r/>> > > > >
Hello. r/>> > > > > br/>> > > I did it with a prrrocessor
EExecuteGroovyScript. r/>> > > > > br/>&&ggt; > > The script body is
somethinng like : r/>> > &ggt;; > > br/>> > > import
> > org.apache.http.entiity.mime.MultipartEntityBuilder
> > > > > import org.apache.http.entity.ContentType br/>> > > > > br/>> > >
flowFFFileList = session.get(100) r/>> > > > >
if(!!!flowFileList.isEmpty()) { r/>> > > > > flowFFFileList.each { flowFile
-> br//>> > > def multipart r/>&> > &> > > String text =
flowFile.read().getText("UTF-8") br/>> > > > > br/>> > >
flowFFFile.write{streamIn, streamOut-> r/>> > > > > multipart D
MultipartEntityBuilder.create() r/>> > > &ggt; > //speciffy multipart
entries here r/>> > > > &ggt; .addTextBody(""object", text, r/>> > > > >
ContentType.APPLICATTION_JSON) r/>> > > > > .addBiinaryBody(""content", new
r/>> > > > > FFFile(flowFile.'document.content.path'), r/>> > > > >
ContentType.create(flowFFile.'document.mime.type'), r/>> &gtt; > > >
flowFFile.'document.name') r/>> > > &> > .build() r/>> > > > >
multipart.writeTo(streamOut) r/>> > > > > }}} r/>> > > > >; ///set the
`documentum.action.rest.content.type` attribute to br/>&> > > > > be used
as `Content-Type` in InvokeHTTP br/>> > > > >
flowFFile.'document.content.type' = br/>> > > > >
multipart.getContentType().getValue() br/>> > > > >
session.transfer(flowFFile, REL_SUCCESS) r/>> > > > > }}} r/>> > > &ggt; >
}} r/>> > > > > br/>> > > brr/>> > > Attributes are : < r/>> > > > &>
document.conntent.path : content path r/>> > > > &ggt; document.mime..type
: content mime type r/>> > > > &> document.name : binaire content name r/>>
> > > &ggt; br/>> >; > Output update attribute < r/>> >; > > >
docuument.content.type : multipart content type. r//>> > > > > br/>> > >
You need some extra librairries : r/>&gtt; > > > > httpcore-4.4.12.jar r/>>
> > > &ggt; httpmime-4.5.10.jar r/>> > > > > br/>> >; > This will build a
multipartt as the flowfile
> > content and you can r/>> > > > > ussse it for the call after. r/>> > >
> > br/>> &&ggt; > br/>> > > Etienne < r/>> > > >; &> br/>> > > br/>> > >
Le lun. 27 avr. 2020 à 19:21, Luis
> > Carmona < r/>> > > > > lcarmona@@@openpartner.cl> a écrit : r/>> > > >
&gtt; &> Hi everyone, r/>> > > > > > br/>> &> > > Hoping everybody is doing
ok, wherever you are,
> > need some help r/>> > > > > > plllease. r/>> > > > > > br/>> > > >
DDoes anyone has ssent a file and parameters to
> > a REST point r/>> > > > > > usinnng r/>> > > > > > Invokehhtp with
multipart/form--ddata as mime-type ? r/>> > > > > > br/>>; &> > > I can't
figure ouut how to include the -F
> > <parameter>, speaking r/>> > > >;; > > in terms r/>> > > > > > of curl
syntaaxx. r/>> > > > > > br/>> > > > I rreaally need thiis done throught
NIFIso any
> > help will be highly r/>> > > > > &gggt; apreciated. r/>> > > > > >
br/>> > &&ggt; > Thanks in advancee. r/>> > > > > > br/&&gtt;> > > > LC <
r/>> > > > > > brr/&ggt;> br/>> br/> < r/> <

Re: POST multipart/form-data with Invokehttp

Posted by Mark Payne <ma...@hotmail.com>.
I would assume that I just used curl to send some multipart/form data and verified that it properly received the data. But I don’t remember specifically.

On Apr 29, 2020, at 2:44 PM, Otto Fowler <ot...@gmail.com>> wrote:

Mark do you remember what you did to verify https://github.com/apache/nifi/pull/2991?  Or know of an article?


On April 29, 2020 at 13:40:17, Mark Payne (markap14@hotmail.com<ma...@hotmail.com>) wrote:

Thanks Otto, I think a blog would be hugely helpful. People ask a lot of times how to do multipart/form uploads. Now we can do it, but people won’t know until they see a blog telling them. And it means when someone asks we can just hand them a link :)

-Mark

On Apr 29, 2020, at 1:27 PM, Otto Fowler <ot...@gmail.com>> wrote:

Note, I did some revisions based on review, so it is slightly different than the original submittal.  You’ll want to see it again.  Maybe I’ll write up a blog if I find some time


On April 28, 2020 at 01:01:14, Otto Fowler (ottobackwards@gmail.com<ma...@gmail.com>) wrote:

Well it is in review right now, and there will be changes up coming.


On April 27, 2020 at 23:12:21, Luis Carmona (lcarmona@openpartner.cl<ma...@openpartner.cl>) wrote:

Hi Otto,

Compiled your version, and It DID WORK !!.

How risky is to use this "version" in a production environment ?

Thanks a lot.

LC




On Mon, 2020-04-27 at 11:05 -0700, Otto Fowler wrote:
> No, Luis, if the PR is accepted and lands, it will be in the next
> released version of nifi after that.
> r/>> If you build nifi yourself, it will be availabllle when you build
> master after it lands. r/>> r/>> On April 27, 2020 at 13:56:36, Luis Carmona (lcarmona@@@openpartner.cl<http://openpartner.cl/>)
> wrote:
> > Thank you all, r/>> > r/>> > Wesley and Etienne, is there any documentation source aaabout how to r/>> > connect a script in javascript to nifi reessources, InputStream, r/>> > OutputStream, Erros, and so on ?? r/>> > r/>> > r/>> > Otto, sure I can give it a try, I am desperate for thisss solution.
> > What r/>> > you mention means I have to lookkk for a tutorial about adding a
> > custom r/>> > processor right ??? rr/>&> > r/>> > r/>> > Thanks again, r/>> > r/>> > LC r/>> > r/>> > r/>> > r/>> > r/>> > On Mon, 2020-04-27 at 14:52 -0300, Wesley C. Dias de Ollliveira
> > wrote: r/>> > > Owh!!! r/>> &>; > br/>> Great, Otto!! r/>> > > br/>&ggt; GGood news!! r/>> > > br/>> Em seg., 27 de abbr. dee 2020 às 14:50, Ottto Fowler < r/>> > > ottobaackwards@gmail.com<ma...@gmail.com>> escreveu: r/>> > > > Whaat good timing, I just did : br/>> >
> > https:://github.com/apache/nifi/pull/4234<http://github.com/apache/nifi/pull/4234> r/>> > > > If you can build and try that would be sweet! or maybe a
> > review! br/>> > br/>> > On April 27, 2020 at 13:45:42, Etienne
> > Jouvin ( < r/>> > > > lapinoujoujouuu@gmail.com<ma...@gmail.com>) wrote: r/>> > > > > Hello. r/>> > > > > br/>> > > I did it with a prrrocessor EExecuteGroovyScript. r/>> > > > > br/>&&ggt; > > The script body is somethinng like : r/>> > &ggt;; > > br/>> > > import
> > org.apache.http.entiity.mime.MultipartEntityBuilder
> > > > > import org.apache.http.entity.ContentType br/>> > > > > br/>> > > flowFFFileList = session.get(100) r/>> > > > > if(!!!flowFileList.isEmpty()) { r/>> > > > > flowFFFileList.each { flowFile -> br//>> > > def multipart r/>&> > &> > > String text = flowFile.read().getText("UTF-8") br/>> > > > > br/>> > > flowFFFile.write{streamIn, streamOut-> r/>> > > > > multipart D MultipartEntityBuilder.create() r/>> > > &ggt; > //speciffy multipart entries here r/>> > > > &ggt; .addTextBody(""object", text, r/>> > > > > ContentType.APPLICATTION_JSON) r/>> > > > > .addBiinaryBody(""content", new r/>> > > > > FFFile(flowFile.'document.content.path'), r/>> > > > > ContentType.create(flowFFile.'document.mime.type'), r/>> &gtt; > > > flowFFile.'document.name<http://document.name/>') r/>> > > &> > .build() r/>> > > > > multipart.writeTo(streamOut) r/>> > > > > }}} r/>> > > > >; ///set the `documentum.action.rest.content.type` attribute to br/>&> > > > > be used as `Content-Type` in InvokeHTTP br/>> > > > > flowFFile.'document.content.type' = br/>> > > > > multipart.getContentType().getValue() br/>> > > > > session.transfer(flowFFile, REL_SUCCESS) r/>> > > > > }}} r/>> > > &ggt; > }} r/>> > > > > br/>> > > brr/>> > > Attributes are : < r/>> > > > &> document.conntent.path : content path r/>> > > > &ggt; document.mime..type : content mime type r/>> > > > &> document.name<http://document.name/> : binaire content name r/>> > > > &ggt; br/>> >; > Output update attribute < r/>> >; > > > docuument.content.type : multipart content type. r//>> > > > > br/>> > > You need some extra librairries : r/>&gtt; > > > > httpcore-4.4.12.jar r/>> > > > &ggt; httpmime-4.5.10.jar r/>> > > > > br/>> >; > This will build a multipartt as the flowfile
> > content and you can r/>> > > > > ussse it for the call after. r/>> > > > > br/>> &&ggt; > br/>> > > Etienne < r/>> > > >; &> br/>> > > br/>> > > Le lun. 27 avr. 2020 à 19:21, Luis
> > Carmona < r/>> > > > > lcarmona@@@openpartner.cl<http://openpartner.cl/>> a écrit : r/>> > > > &gtt; &> Hi everyone, r/>> > > > > > br/>> &> > > Hoping everybody is doing ok, wherever you are,
> > need some help r/>> > > > > > plllease. r/>> > > > > > br/>> > > > DDoes anyone has ssent a file and parameters to
> > a REST point r/>> > > > > > usinnng r/>> > > > > > Invokehhtp with multipart/form--ddata as mime-type ? r/>> > > > > > br/>>; &> > > I can't figure ouut how to include the -F
> > <parameter>, speaking r/>> > > >;; > > in terms r/>> > > > > > of curl syntaaxx. r/>> > > > > > br/>> > > > I rreaally need thiis done throught NIFIso any
> > help will be highly r/>> > > > > &gggt; apreciated. r/>> > > > > > br/>> > &&ggt; > Thanks in advancee. r/>> > > > > > br/&&gtt;> > > > LC < r/>> > > > > > brr/&ggt;> br/>> br/> < r/> <



Re: POST multipart/form-data with Invokehttp

Posted by Otto Fowler <ot...@gmail.com>.
 Mark do you remember what you did to verify
https://github.com/apache/nifi/pull/2991?  Or know of an article?

On April 29, 2020 at 13:40:17, Mark Payne (markap14@hotmail.com) wrote:

Thanks Otto, I think a blog would be hugely helpful. People ask a lot of
times how to do multipart/form uploads. Now we can do it, but people won’t
know until they see a blog telling them. And it means when someone asks we
can just hand them a link :)

-Mark

On Apr 29, 2020, at 1:27 PM, Otto Fowler <ot...@gmail.com> wrote:

Note, I did some revisions based on review, so it is slightly different
than the original submittal.  You’ll want to see it again.  Maybe I’ll
write up a blog if I find some time

On April 28, 2020 at 01:01:14, Otto Fowler (ottobackwards@gmail.com) wrote:

Well it is in review right now, and there will be changes up coming.

On April 27, 2020 at 23:12:21, Luis Carmona (lcarmona@openpartner.cl) wrote:

Hi Otto,

Compiled your version, and It DID WORK !!.

How risky is to use this "version" in a production environment ?

Thanks a lot.

LC




On Mon, 2020-04-27 at 11:05 -0700, Otto Fowler wrote:
> No, Luis, if the PR is accepted and lands, it will be in the next
> released version of nifi after that.
> r/>> If you build nifi yourself, it will be availabllle when you build
> master after it lands. r/>> r/>> On April 27, 2020 at 13:56:36, Luis
Carmona (lcarmona@@@openpartner.cl)
> wrote:
> > Thank you all, r/>> > r/>> > Wesley and Etienne, is there any
documentation source aaabout how to r/>> > connect a script in javascript
to nifi reessources, InputStream, r/>> > OutputStream, Erros, and so on ??
r/>> > r/>> > r/>> > Otto, sure I can give it a try, I am desperate for
thisss solution.
> > What r/>> > you mention means I have to lookkk for a tutorial about
adding a
> > custom r/>> > processor right ??? rr/>&> > r/>> > r/>> > Thanks again,
r/>> > r/>> > LC r/>> > r/>> > r/>> > r/>> > r/>> > On Mon, 2020-04-27 at
14:52 -0300, Wesley C. Dias de Ollliveira
> > wrote: r/>> > > Owh!!! r/>> &>; > br/>> Great, Otto!! r/>> > >
br/>&ggt; GGood news!! r/>> > > br/>> Em seg., 27 de abbr. dee 2020 às
14:50, Ottto Fowler < r/>> > > ottobaackwards@gmail.com> escreveu: r/>> > >
> Whaat good timing, I just did : br/>> >
> > https:://github.com/apache/nifi/pull/4234 r/>> > > > If you can build
and try that would be sweet! or maybe a
> > review! br/>> > br/>> > On April 27, 2020 at 13:45:42, Etienne
> > Jouvin ( < r/>> > > > lapinoujoujouuu@gmail.com) wrote: r/>> > > > >
Hello. r/>> > > > > br/>> > > I did it with a prrrocessor
EExecuteGroovyScript. r/>> > > > > br/>&&ggt; > > The script body is
somethinng like : r/>> > &ggt;; > > br/>> > > import
> > org.apache.http.entiity.mime.MultipartEntityBuilder
> > > > > import org.apache.http.entity.ContentType br/>> > > > > br/>> > >
flowFFFileList = session.get(100) r/>> > > > >
if(!!!flowFileList.isEmpty()) { r/>> > > > > flowFFFileList.each { flowFile
-> br//>> > > def multipart r/>&> > &> > > String text =
flowFile.read().getText("UTF-8") br/>> > > > > br/>> > >
flowFFFile.write{streamIn, streamOut-> r/>> > > > > multipart D
MultipartEntityBuilder.create() r/>> > > &ggt; > //speciffy multipart
entries here r/>> > > > &ggt; .addTextBody(""object", text, r/>> > > > >
ContentType.APPLICATTION_JSON) r/>> > > > > .addBiinaryBody(""content", new
r/>> > > > > FFFile(flowFile.'document.content.path'), r/>> > > > >
ContentType.create(flowFFile.'document.mime.type'), r/>> &gtt; > > >
flowFFile.'document.name') r/>> > > &> > .build() r/>> > > > >
multipart.writeTo(streamOut) r/>> > > > > }}} r/>> > > > >; ///set the
`documentum.action.rest.content.type` attribute to br/>&> > > > > be used
as `Content-Type` in InvokeHTTP br/>> > > > >
flowFFile.'document.content.type' = br/>> > > > >
multipart.getContentType().getValue() br/>> > > > >
session.transfer(flowFFile, REL_SUCCESS) r/>> > > > > }}} r/>> > > &ggt; >
}} r/>> > > > > br/>> > > brr/>> > > Attributes are : < r/>> > > > &>
document.conntent.path : content path r/>> > > > &ggt; document.mime..type
: content mime type r/>> > > > &> document.name : binaire content name r/>>
> > > &ggt; br/>> >; > Output update attribute < r/>> >; > > >
docuument.content.type : multipart content type. r//>> > > > > br/>> > >
You need some extra librairries : r/>&gtt; > > > > httpcore-4.4.12.jar r/>>
> > > &ggt; httpmime-4.5.10.jar r/>> > > > > br/>> >; > This will build a
multipartt as the flowfile
> > content and you can r/>> > > > > ussse it for the call after. r/>> > >
> > br/>> &&ggt; > br/>> > > Etienne < r/>> > > >; &> br/>> > > br/>> > >
Le lun. 27 avr. 2020 à 19:21, Luis
> > Carmona < r/>> > > > > lcarmona@@@openpartner.cl> a écrit : r/>> > > >
&gtt; &> Hi everyone, r/>> > > > > > br/>> &> > > Hoping everybody is doing
ok, wherever you are,
> > need some help r/>> > > > > > plllease. r/>> > > > > > br/>> > > >
DDoes anyone has ssent a file and parameters to
> > a REST point r/>> > > > > > usinnng r/>> > > > > > Invokehhtp with
multipart/form--ddata as mime-type ? r/>> > > > > > br/>>; &> > > I can't
figure ouut how to include the -F
> > <parameter>, speaking r/>> > > >;; > > in terms r/>> > > > > > of curl
syntaaxx. r/>> > > > > > br/>> > > > I rreaally need thiis done throught
NIFIso any
> > help will be highly r/>> > > > > &gggt; apreciated. r/>> > > > > >
br/>> > &&ggt; > Thanks in advancee. r/>> > > > > > br/&&gtt;> > > > LC <
r/>> > > > > > brr/&ggt;> br/>> br/> < r/> <

Re: POST multipart/form-data with Invokehttp

Posted by Mark Payne <ma...@hotmail.com>.
Thanks Otto, I think a blog would be hugely helpful. People ask a lot of times how to do multipart/form uploads. Now we can do it, but people won’t know until they see a blog telling them. And it means when someone asks we can just hand them a link :)

-Mark

On Apr 29, 2020, at 1:27 PM, Otto Fowler <ot...@gmail.com>> wrote:

Note, I did some revisions based on review, so it is slightly different than the original submittal.  You’ll want to see it again.  Maybe I’ll write up a blog if I find some time


On April 28, 2020 at 01:01:14, Otto Fowler (ottobackwards@gmail.com<ma...@gmail.com>) wrote:

Well it is in review right now, and there will be changes up coming.


On April 27, 2020 at 23:12:21, Luis Carmona (lcarmona@openpartner.cl<ma...@openpartner.cl>) wrote:

Hi Otto,

Compiled your version, and It DID WORK !!.

How risky is to use this "version" in a production environment ?

Thanks a lot.

LC




On Mon, 2020-04-27 at 11:05 -0700, Otto Fowler wrote:
> No, Luis, if the PR is accepted and lands, it will be in the next
> released version of nifi after that.
> r/>> If you build nifi yourself, it will be availabllle when you build
> master after it lands. r/>> r/>> On April 27, 2020 at 13:56:36, Luis Carmona (lcarmona@@@openpartner.cl<http://openpartner.cl/>)
> wrote:
> > Thank you all, r/>> > r/>> > Wesley and Etienne, is there any documentation source aaabout how to r/>> > connect a script in javascript to nifi reessources, InputStream, r/>> > OutputStream, Erros, and so on ?? r/>> > r/>> > r/>> > Otto, sure I can give it a try, I am desperate for thisss solution.
> > What r/>> > you mention means I have to lookkk for a tutorial about adding a
> > custom r/>> > processor right ??? rr/>&> > r/>> > r/>> > Thanks again, r/>> > r/>> > LC r/>> > r/>> > r/>> > r/>> > r/>> > On Mon, 2020-04-27 at 14:52 -0300, Wesley C. Dias de Ollliveira
> > wrote: r/>> > > Owh!!! r/>> &>; > br/>> Great, Otto!! r/>> > > br/>&ggt; GGood news!! r/>> > > br/>> Em seg., 27 de abbr. dee 2020 às 14:50, Ottto Fowler < r/>> > > ottobaackwards@gmail.com<ma...@gmail.com>> escreveu: r/>> > > > Whaat good timing, I just did : br/>> >
> > https:://github.com/apache/nifi/pull/4234<http://github.com/apache/nifi/pull/4234> r/>> > > > If you can build and try that would be sweet! or maybe a
> > review! br/>> > br/>> > On April 27, 2020 at 13:45:42, Etienne
> > Jouvin ( < r/>> > > > lapinoujoujouuu@gmail.com<ma...@gmail.com>) wrote: r/>> > > > > Hello. r/>> > > > > br/>> > > I did it with a prrrocessor EExecuteGroovyScript. r/>> > > > > br/>&&ggt; > > The script body is somethinng like : r/>> > &ggt;; > > br/>> > > import
> > org.apache.http.entiity.mime.MultipartEntityBuilder
> > > > > import org.apache.http.entity.ContentType br/>> > > > > br/>> > > flowFFFileList = session.get(100) r/>> > > > > if(!!!flowFileList.isEmpty()) { r/>> > > > > flowFFFileList.each { flowFile -> br//>> > > def multipart r/>&> > &> > > String text = flowFile.read().getText("UTF-8") br/>> > > > > br/>> > > flowFFFile.write{streamIn, streamOut-> r/>> > > > > multipart D MultipartEntityBuilder.create() r/>> > > &ggt; > //speciffy multipart entries here r/>> > > > &ggt; .addTextBody(""object", text, r/>> > > > > ContentType.APPLICATTION_JSON) r/>> > > > > .addBiinaryBody(""content", new r/>> > > > > FFFile(flowFile.'document.content.path'), r/>> > > > > ContentType.create(flowFFile.'document.mime.type'), r/>> &gtt; > > > flowFFile.'document.name<http://document.name/>') r/>> > > &> > .build() r/>> > > > > multipart.writeTo(streamOut) r/>> > > > > }}} r/>> > > > >; ///set the `documentum.action.rest.content.type` attribute to br/>&> > > > > be used as `Content-Type` in InvokeHTTP br/>> > > > > flowFFile.'document.content.type' = br/>> > > > > multipart.getContentType().getValue() br/>> > > > > session.transfer(flowFFile, REL_SUCCESS) r/>> > > > > }}} r/>> > > &ggt; > }} r/>> > > > > br/>> > > brr/>> > > Attributes are : < r/>> > > > &> document.conntent.path : content path r/>> > > > &ggt; document.mime..type : content mime type r/>> > > > &> document.name<http://document.name/> : binaire content name r/>> > > > &ggt; br/>> >; > Output update attribute < r/>> >; > > > docuument.content.type : multipart content type. r//>> > > > > br/>> > > You need some extra librairries : r/>&gtt; > > > > httpcore-4.4.12.jar r/>> > > > &ggt; httpmime-4.5.10.jar r/>> > > > > br/>> >; > This will build a multipartt as the flowfile
> > content and you can r/>> > > > > ussse it for the call after. r/>> > > > > br/>> &&ggt; > br/>> > > Etienne < r/>> > > >; &> br/>> > > br/>> > > Le lun. 27 avr. 2020 à 19:21, Luis
> > Carmona < r/>> > > > > lcarmona@@@openpartner.cl<http://openpartner.cl/>> a écrit : r/>> > > > &gtt; &> Hi everyone, r/>> > > > > > br/>> &> > > Hoping everybody is doing ok, wherever you are,
> > need some help r/>> > > > > > plllease. r/>> > > > > > br/>> > > > DDoes anyone has ssent a file and parameters to
> > a REST point r/>> > > > > > usinnng r/>> > > > > > Invokehhtp with multipart/form--ddata as mime-type ? r/>> > > > > > br/>>; &> > > I can't figure ouut how to include the -F
> > <parameter>, speaking r/>> > > >;; > > in terms r/>> > > > > > of curl syntaaxx. r/>> > > > > > br/>> > > > I rreaally need thiis done throught NIFIso any
> > help will be highly r/>> > > > > &gggt; apreciated. r/>> > > > > > br/>> > &&ggt; > Thanks in advancee. r/>> > > > > > br/&&gtt;> > > > LC < r/>> > > > > > brr/&ggt;> br/>> br/> < r/> <


Re: POST multipart/form-data with Invokehttp

Posted by Otto Fowler <ot...@gmail.com>.
 Note, I did some revisions based on review, so it is slightly different
than the original submittal.  You’ll want to see it again.  Maybe I’ll
write up a blog if I find some time

On April 28, 2020 at 01:01:14, Otto Fowler (ottobackwards@gmail.com) wrote:

Well it is in review right now, and there will be changes up coming.

On April 27, 2020 at 23:12:21, Luis Carmona (lcarmona@openpartner.cl) wrote:

Hi Otto,

Compiled your version, and It DID WORK !!.

How risky is to use this "version" in a production environment ?

Thanks a lot.

LC




On Mon, 2020-04-27 at 11:05 -0700, Otto Fowler wrote:
> No, Luis, if the PR is accepted and lands, it will be in the next
> released version of nifi after that.
> r/>> If you build nifi yourself, it will be availabllle when you build
> master after it lands. r/>> r/>> On April 27, 2020 at 13:56:36, Luis
Carmona (lcarmona@@@openpartner.cl)
> wrote:
> > Thank you all, r/>> > r/>> > Wesley and Etienne, is there any
documentation source aaabout how to r/>> > connect a script in javascript
to nifi reessources, InputStream, r/>> > OutputStream, Erros, and so on ??
r/>> > r/>> > r/>> > Otto, sure I can give it a try, I am desperate for
thisss solution.
> > What r/>> > you mention means I have to lookkk for a tutorial about
adding a
> > custom r/>> > processor right ??? rr/>&> > r/>> > r/>> > Thanks again,
r/>> > r/>> > LC r/>> > r/>> > r/>> > r/>> > r/>> > On Mon, 2020-04-27 at
14:52 -0300, Wesley C. Dias de Ollliveira
> > wrote: r/>> > > Owh!!! r/>> &>; > br/>> Great, Otto!! r/>> > >
br/>&ggt; GGood news!! r/>> > > br/>> Em seg., 27 de abbr. dee 2020 às
14:50, Ottto Fowler < r/>> > > ottobaackwards@gmail.com> escreveu: r/>> > >
> Whaat good timing, I just did : br/>> >
> > https:://github.com/apache/nifi/pull/4234 r/>> > > > If you can build
and try that would be sweet! or maybe a
> > review! br/>> > br/>> > On April 27, 2020 at 13:45:42, Etienne
> > Jouvin ( < r/>> > > > lapinoujoujouuu@gmail.com) wrote: r/>> > > > >
Hello. r/>> > > > > br/>> > > I did it with a prrrocessor
EExecuteGroovyScript. r/>> > > > > br/>&&ggt; > > The script body is
somethinng like : r/>> > &ggt;; > > br/>> > > import
> > org.apache.http.entiity.mime.MultipartEntityBuilder
> > > > > import org.apache.http.entity.ContentType br/>> > > > > br/>> > >
flowFFFileList = session.get(100) r/>> > > > >
if(!!!flowFileList.isEmpty()) { r/>> > > > > flowFFFileList.each { flowFile
-> br//>> > > def multipart r/>&> > &> > > String text =
flowFile.read().getText("UTF-8") br/>> > > > > br/>> > >
flowFFFile.write{streamIn, streamOut-> r/>> > > > > multipart D
MultipartEntityBuilder.create() r/>> > > &ggt; > //speciffy multipart
entries here r/>> > > > &ggt; .addTextBody(""object", text, r/>> > > > >
ContentType.APPLICATTION_JSON) r/>> > > > > .addBiinaryBody(""content", new
r/>> > > > > FFFile(flowFile.'document.content.path'), r/>> > > > >
ContentType.create(flowFFile.'document.mime.type'), r/>> &gtt; > > >
flowFFile.'document.name') r/>> > > &> > .build() r/>> > > > >
multipart.writeTo(streamOut) r/>> > > > > }}} r/>> > > > >; ///set the
`documentum.action.rest.content.type` attribute to br/>&> > > > > be used
as `Content-Type` in InvokeHTTP br/>> > > > >
flowFFile.'document.content.type' = br/>> > > > >
multipart.getContentType().getValue() br/>> > > > >
session.transfer(flowFFile, REL_SUCCESS) r/>> > > > > }}} r/>> > > &ggt; >
}} r/>> > > > > br/>> > > brr/>> > > Attributes are : < r/>> > > > &>
document.conntent.path : content path r/>> > > > &ggt; document.mime..type
: content mime type r/>> > > > &> document.name : binaire content name r/>>
> > > &ggt; br/>> >; > Output update attribute < r/>> >; > > >
docuument.content.type : multipart content type. r//>> > > > > br/>> > >
You need some extra librairries : r/>&gtt; > > > > httpcore-4.4.12.jar r/>>
> > > &ggt; httpmime-4.5.10.jar r/>> > > > > br/>> >; > This will build a
multipartt as the flowfile
> > content and you can r/>> > > > > ussse it for the call after. r/>> > >
> > br/>> &&ggt; > br/>> > > Etienne < r/>> > > >; &> br/>> > > br/>> > >
Le lun. 27 avr. 2020 à 19:21, Luis
> > Carmona < r/>> > > > > lcarmona@@@openpartner.cl> a écrit : r/>> > > >
&gtt; &> Hi everyone, r/>> > > > > > br/>> &> > > Hoping everybody is doing
ok, wherever you are,
> > need some help r/>> > > > > > plllease. r/>> > > > > > br/>> > > >
DDoes anyone has ssent a file and parameters to
> > a REST point r/>> > > > > > usinnng r/>> > > > > > Invokehhtp with
multipart/form--ddata as mime-type ? r/>> > > > > > br/>>; &> > > I can't
figure ouut how to include the -F
> > <parameter>, speaking r/>> > > >;; > > in terms r/>> > > > > > of curl
syntaaxx. r/>> > > > > > br/>> > > > I rreaally need thiis done throught
NIFIso any
> > help will be highly r/>> > > > > &gggt; apreciated. r/>> > > > > >
br/>> > &&ggt; > Thanks in advancee. r/>> > > > > > br/&&gtt;> > > > LC <
r/>> > > > > > brr/&ggt;> br/>> br/> < r/> <

Re: POST multipart/form-data with Invokehttp

Posted by Otto Fowler <ot...@gmail.com>.
 Ok, that PR has landed.  So the new code is on master and it will be in
the next release.  Thanks to Mark for the review.

On April 28, 2020 at 01:01:14, Otto Fowler (ottobackwards@gmail.com) wrote:

Well it is in review right now, and there will be changes up coming.

On April 27, 2020 at 23:12:21, Luis Carmona (lcarmona@openpartner.cl) wrote:

Hi Otto,

Compiled your version, and It DID WORK !!.

How risky is to use this "version" in a production environment ?

Thanks a lot.

LC




On Mon, 2020-04-27 at 11:05 -0700, Otto Fowler wrote:
> No, Luis, if the PR is accepted and lands, it will be in the next
> released version of nifi after that.
> r/>> If you build nifi yourself, it will be availabllle when you build
> master after it lands. r/>> r/>> On April 27, 2020 at 13:56:36, Luis
Carmona (lcarmona@@@openpartner.cl)
> wrote:
> > Thank you all, r/>> > r/>> > Wesley and Etienne, is there any
documentation source aaabout how to r/>> > connect a script in javascript
to nifi reessources, InputStream, r/>> > OutputStream, Erros, and so on ??
r/>> > r/>> > r/>> > Otto, sure I can give it a try, I am desperate for
thisss solution.
> > What r/>> > you mention means I have to lookkk for a tutorial about
adding a
> > custom r/>> > processor right ??? rr/>&> > r/>> > r/>> > Thanks again,
r/>> > r/>> > LC r/>> > r/>> > r/>> > r/>> > r/>> > On Mon, 2020-04-27 at
14:52 -0300, Wesley C. Dias de Ollliveira
> > wrote: r/>> > > Owh!!! r/>> &>; > br/>> Great, Otto!! r/>> > >
br/>&ggt; GGood news!! r/>> > > br/>> Em seg., 27 de abbr. dee 2020 às
14:50, Ottto Fowler < r/>> > > ottobaackwards@gmail.com> escreveu: r/>> > >
> Whaat good timing, I just did : br/>> >
> > https:://github.com/apache/nifi/pull/4234 r/>> > > > If you can build
and try that would be sweet! or maybe a
> > review! br/>> > br/>> > On April 27, 2020 at 13:45:42, Etienne
> > Jouvin ( < r/>> > > > lapinoujoujouuu@gmail.com) wrote: r/>> > > > >
Hello. r/>> > > > > br/>> > > I did it with a prrrocessor
EExecuteGroovyScript. r/>> > > > > br/>&&ggt; > > The script body is
somethinng like : r/>> > &ggt;; > > br/>> > > import
> > org.apache.http.entiity.mime.MultipartEntityBuilder
> > > > > import org.apache.http.entity.ContentType br/>> > > > > br/>> > >
flowFFFileList = session.get(100) r/>> > > > >
if(!!!flowFileList.isEmpty()) { r/>> > > > > flowFFFileList.each { flowFile
-> br//>> > > def multipart r/>&> > &> > > String text =
flowFile.read().getText("UTF-8") br/>> > > > > br/>> > >
flowFFFile.write{streamIn, streamOut-> r/>> > > > > multipart D
MultipartEntityBuilder.create() r/>> > > &ggt; > //speciffy multipart
entries here r/>> > > > &ggt; .addTextBody(""object", text, r/>> > > > >
ContentType.APPLICATTION_JSON) r/>> > > > > .addBiinaryBody(""content", new
r/>> > > > > FFFile(flowFile.'document.content.path'), r/>> > > > >
ContentType.create(flowFFile.'document.mime.type'), r/>> &gtt; > > >
flowFFile.'document.name') r/>> > > &> > .build() r/>> > > > >
multipart.writeTo(streamOut) r/>> > > > > }}} r/>> > > > >; ///set the
`documentum.action.rest.content.type` attribute to br/>&> > > > > be used
as `Content-Type` in InvokeHTTP br/>> > > > >
flowFFile.'document.content.type' = br/>> > > > >
multipart.getContentType().getValue() br/>> > > > >
session.transfer(flowFFile, REL_SUCCESS) r/>> > > > > }}} r/>> > > &ggt; >
}} r/>> > > > > br/>> > > brr/>> > > Attributes are : < r/>> > > > &>
document.conntent.path : content path r/>> > > > &ggt; document.mime..type
: content mime type r/>> > > > &> document.name : binaire content name r/>>
> > > &ggt; br/>> >; > Output update attribute < r/>> >; > > >
docuument.content.type : multipart content type. r//>> > > > > br/>> > >
You need some extra librairries : r/>&gtt; > > > > httpcore-4.4.12.jar r/>>
> > > &ggt; httpmime-4.5.10.jar r/>> > > > > br/>> >; > This will build a
multipartt as the flowfile
> > content and you can r/>> > > > > ussse it for the call after. r/>> > >
> > br/>> &&ggt; > br/>> > > Etienne < r/>> > > >; &> br/>> > > br/>> > >
Le lun. 27 avr. 2020 à 19:21, Luis
> > Carmona < r/>> > > > > lcarmona@@@openpartner.cl> a écrit : r/>> > > >
&gtt; &> Hi everyone, r/>> > > > > > br/>> &> > > Hoping everybody is doing
ok, wherever you are,
> > need some help r/>> > > > > > plllease. r/>> > > > > > br/>> > > >
DDoes anyone has ssent a file and parameters to
> > a REST point r/>> > > > > > usinnng r/>> > > > > > Invokehhtp with
multipart/form--ddata as mime-type ? r/>> > > > > > br/>>; &> > > I can't
figure ouut how to include the -F
> > <parameter>, speaking r/>> > > >;; > > in terms r/>> > > > > > of curl
syntaaxx. r/>> > > > > > br/>> > > > I rreaally need thiis done throught
NIFIso any
> > help will be highly r/>> > > > > &gggt; apreciated. r/>> > > > > >
br/>> > &&ggt; > Thanks in advancee. r/>> > > > > > br/&&gtt;> > > > LC <
r/>> > > > > > brr/&ggt;> br/>> br/> < r/> <

Re: POST multipart/form-data with Invokehttp

Posted by Otto Fowler <ot...@gmail.com>.
 Well it is in review right now, and there will be changes up coming.

On April 27, 2020 at 23:12:21, Luis Carmona (lcarmona@openpartner.cl) wrote:

Hi Otto,

Compiled your version, and It DID WORK !!.

How risky is to use this "version" in a production environment ?

Thanks a lot.

LC




On Mon, 2020-04-27 at 11:05 -0700, Otto Fowler wrote:
> No, Luis, if the PR is accepted and lands, it will be in the next
> released version of nifi after that.
> br/>> If you build nifi yourself, it will be availablle when you build
> master after it lands. br/>> br/>> On April 27, 2020 at 13:56:36, Luis
Carmona (lcarmona@@openpartner.cl)
> wrote:
> > Thank you all, br/>> > br/>> > Wesley and Etienne, is there any
documentation source aabout how to br/>> > connect a script in javascript
to nifi ressources, InputStream, br/>> > OutputStream, Erros, and so on ??
br/>> > br/>> > br/>> > Otto, sure I can give it a try, I am desperate for
thiss solution.
> > What br/>> > you mention means I have to lookk for a tutorial about
adding a
> > custom br/>> > processor right ?? br/>&> > br/>> > br/>> > Thanks
again, br/>> > br/>> > LC br/>> > br/>> > br/>> > br/>> > br/>> > On Mon,
2020-04-27 at 14:52 -0300, Wesley C. Dias de Olliveira
> > wrote: br/>> > > Owh!! br/>> >; > br/>> Great, Otto!! br/>> > > br/>>
GGood news!! br/>> > > br/>> Em seg., 27 de abr. dee 2020 às 14:50, Ottto
Fowler < br/>> > > ottobaackwards@gmail.com> escreveu: br/>> > > > What
good timing, I just did : br/>> >
> > https:://github.com/apache/nifi/pull/4234 br/>> > > > If you can build
and try that would be sweet! or maybe a
> > review! br/>> > br/>> > On April 27, 2020 at 13:45:42, Etienne
> > Jouvin ( < br/>> > > > lapinoujoujouu@gmail.com) wrote: br/>> > > > >
Hello. br/>> > > > > br/>> > > I did it with a prrocessor
EExecuteGroovyScript. br/>> > > > > br/>&ggt; > > The script body is
somethinng like : br/>> > >; > > br/>> > > import
> > org.apache.http.entiity.mime.MultipartEntityBuilder
> > > > > import org.apache.http.entity.ContentType
> > > > > br/>> > > flowFFileList = session.get(100) br/>> > > > >
if(!!flowFileList.isEmpty()) { br/>> > > > > flowFFileList.each { flowFile
-> br//>> > > def multipart br/>> > &> > > String text =
flowFile.read().getText("UTF-8")
> > > > > br/>> > > flowFFile.write{streamIn, streamOut-> br/>> > > > >
multipart = MultipartEntityBuilder.create() br/>> > > > > //speciffy
multipart entries here br/>> > > > > .addTextBody(""object", text, br/>> >
> > > ContentType.APPLICATTION_JSON) br/>> > > > >
.addBinaryBody(""content", new br/>> > > > >
FFile(flowFile.'document.content.path'), br/>> > > > >
ContentType.create(flowFFile.'document.mime.type'), br/>> > > > >
flowFFile.'document.name') br/>> > > > > .build() br/>> > > > >
multipart.writeTo(streamOut) br/>> > > > > }} br/>> > > > > ///set the
`documentum.action.rest.content.type` attribute to br/>&> > > > > be used
as `Content-Type` in InvokeHTTP
> > > > > flowFile.'document.content.type' =
> > > > > multipart.getContentType().getValue() bbr/>> > > > >
session.transfer(flowFile, REL_SUCCESS) br/>> > > > > }} br/>> > > > > }}
br/>> > > > > br/>> > > br/>> > > Attributes are : < br/>> > > > >
document.conntent.path : content path br/>> > > > > document.mime..type :
content mime type br/>> > > > > document.name : binaire content name br/>>
> > > > br/>> >; > Output update attribute < br/>> > > > >
docuument.content.type : multipart content type. br/>> > > > > br/>> > >
You need some extra librairries : br/>&gtt; > > > > httpcore-4.4.12.jar
br/>> > > > &ggt; httpmime-4.5.10.jar br/>> > > > > br/>> >; > This will
build a multipartt as the flowfile
> > content and you can br/>> > > > > usse it for the call after. br/>> > >
> > br/>> &ggt; > br/>> > > Etienne < br/>> > > > &> br/>> > > br/>> > > Le
lun. 27 avr. 2020 à 19:21, Luis
> > Carmona < br/>> > > > > lcarmona@@openpartner.cl> a écrit : br/>> > > >
> &> Hi everyone, br/>> > > > > > br/>> > > > Hoping everybody is doing ok,
wherever you are,
> > need some help br/>> > > > > > pllease. br/>> > > > > > br/>> > > >
DDoes anyone has ssent a file and parameters to
> > a REST point br/>> > > > > > usinng br/>> > > > > > Invokehhtp with
multipart/form-ddata as mime-type ? br/>> > > > > > br/>> &> > > I can't
figure ouut how to include the -F
> > <parameter>, speaking br/>> > > >; > > in terms br/>> > > > > > of curl
syntaxx. br/>> > > > > > br/>> > > > I reaally need thiis done throught
NIFIso any
> > help will be highly br/>> > > > > &ggt; apreciated. br/>> > > > > >
br/>> > &ggt; > Thanks in advancee. br/>> > > > > > br/&gtt;> > > > LC <
br/>> > > > > > br/&ggt;> br/>> br/> < br/> <

Re: POST multipart/form-data with Invokehttp

Posted by Luis Carmona <lc...@openpartner.cl>.
Hi Otto,

Compiled your version, and It DID WORK !!.

How risky is to use this "version" in a production environment ?

Thanks a lot.

LC




On Mon, 2020-04-27 at 11:05 -0700, Otto Fowler wrote:
> No, Luis,  if the PR is accepted and lands, it will be in the next
> released version of nifi after that.
> 
> If you build nifi yourself, it will be available when you build
> master after it lands. 
> 
> On April 27, 2020 at 13:56:36, Luis Carmona (lcarmona@openpartner.cl)
> wrote:
> > Thank you all, 
> > 
> > Wesley and Etienne, is there any documentation source about how to 
> > connect a script in javascript to nifi resources, InputStream, 
> > OutputStream, Erros, and so on ? 
> > 
> > 
> > Otto, sure I can give it a try, I am desperate for this solution.
> > What 
> > you mention means I have to look for a tutorial about adding a
> > custom 
> > processor right ? 
> > 
> > 
> > Thanks again, 
> > 
> > LC 
> > 
> > 
> > 
> > 
> > On Mon, 2020-04-27 at 14:52 -0300, Wesley C. Dias de Oliveira
> > wrote: 
> > > Owh! 
> > > br/>> Great, Otto!! 
> > > br/>> Good news!! 
> > > br/>> Em seg., 27 de abr. de 2020 às 14:50, Ottto Fowler < 
> > > ottobackwards@gmail.com> escreveu: 
> > > > What good timing, I just did : br/>> >
> > https:://github.com/apache/nifi/pull/4234 
> > > > If you can build and try that would be sweet! or maybe a
> > review! br/>> > br/>> > On April 27, 2020 at 13:45:42, Etienne
> > Jouvin ( < 
> > > > lapinoujoujou@gmail.com) wrote: 
> > > > > Hello. 
> > > > > br/>> > > I did it with a processor EExecuteGroovyScript. 
> > > > > br/>> > > The script body is somethinng like : 
> > > > > br/>> > > import
> > org.apache.http.entiity.mime.MultipartEntityBuilder 
> > > > > import org.apache.http.entity.ContentType 
> > > > > br/>> > > flowFFileList = session.get(100) 
> > > > > if(!flowFileList.isEmpty()) { 
> > > > > flowFileList.each { flowFile -> br//>> > > def multipart 
> > > > > String text = flowFile.read().getText("UTF-8") 
> > > > > br/>> > > flowFFile.write{streamIn, streamOut-> 
> > > > > multipart = MultipartEntityBuilder.create() 
> > > > > //specify multipart entries here 
> > > > > .addTextBody("object", text, 
> > > > > ContentType.APPLICATION_JSON) 
> > > > > .addBinaryBody("content", new 
> > > > > File(flowFile.'document.content.path'), 
> > > > > ContentType.create(flowFile.'document.mime.type'), 
> > > > > flowFile.'document.name') 
> > > > > .build() 
> > > > > multipart.writeTo(streamOut) 
> > > > > } 
> > > > > //set the `documentum.action.rest.content.type` attribute to 
> > > > > be used as `Content-Type` in InvokeHTTP 
> > > > > flowFile.'document.content.type' = 
> > > > > multipart.getContentType().getValue() 
> > > > > session.transfer(flowFile, REL_SUCCESS) 
> > > > > } 
> > > > > } 
> > > > > br/>> > > br/>> > > Attributes are : < 
> > > > > document.content.path : content path 
> > > > > document.mime.type : content mime type 
> > > > > document.name : binaire content name 
> > > > > br/>> > > Output update attribute < 
> > > > > document.content.type : multipart content type. 
> > > > > br/>> > > You need some extra librairries : 
> > > > > httpcore-4.4.12.jar 
> > > > > httpmime-4.5.10.jar 
> > > > > br/>> > > This will build a multipartt as the flowfile
> > content and you can 
> > > > > use it for the call after. 
> > > > > br/>> > > br/>> > > Etienne < 
> > > > > br/>> > > br/>> > > Le lun. 27 avr. 2020 à 19:21, Luis
> > Carmona < 
> > > > > lcarmona@openpartner.cl> a écrit : 
> > > > > > Hi everyone, 
> > > > > > br/>> > > > Hoping everybody is doing ok, wherever you are,
> > need some help 
> > > > > > please. 
> > > > > > br/>> > > > Does anyone has ssent a file and parameters to
> > a REST point 
> > > > > > using 
> > > > > > Invokehhtp with multipart/form-data as mime-type ? 
> > > > > > br/>> > > > I can't figure ouut how to include the -F
> > <parameter>, speaking 
> > > > > > in terms 
> > > > > > of curl syntax. 
> > > > > > br/>> > > > I really need thiis done throught NIFIso any
> > help will be highly 
> > > > > > apreciated. 
> > > > > > br/>> > > > Thanks in advancee. 
> > > > > > br/>> > > > LC < 
> > > > > > br/>> br/>> br/> < 


Re: POST multipart/form-data with Invokehttp

Posted by Luis Carmona <lc...@openpartner.cl>.
OK Otto,

got it.

LC



On Mon, 2020-04-27 at 11:05 -0700, Otto Fowler wrote:
> No, Luis,  if the PR is accepted and lands, it will be in the next
> released version of nifi after that.
> 
> If you build nifi yourself, it will be available when you build
> master after it lands. 
> 
> On April 27, 2020 at 13:56:36, Luis Carmona (lcarmona@openpartner.cl)
> wrote:
> > Thank you all, 
> > 
> > Wesley and Etienne, is there any documentation source about how to 
> > connect a script in javascript to nifi resources, InputStream, 
> > OutputStream, Erros, and so on ? 
> > 
> > 
> > Otto, sure I can give it a try, I am desperate for this solution.
> > What 
> > you mention means I have to look for a tutorial about adding a
> > custom 
> > processor right ? 
> > 
> > 
> > Thanks again, 
> > 
> > LC 
> > 
> > 
> > 
> > 
> > On Mon, 2020-04-27 at 14:52 -0300, Wesley C. Dias de Oliveira
> > wrote: 
> > > Owh! 
> > > br/>> Great, Otto!! 
> > > br/>> Good news!! 
> > > br/>> Em seg., 27 de abr. de 2020 às 14:50, Ottto Fowler < 
> > > ottobackwards@gmail.com> escreveu: 
> > > > What good timing, I just did : br/>> >
> > https:://github.com/apache/nifi/pull/4234 
> > > > If you can build and try that would be sweet! or maybe a
> > review! br/>> > br/>> > On April 27, 2020 at 13:45:42, Etienne
> > Jouvin ( < 
> > > > lapinoujoujou@gmail.com) wrote: 
> > > > > Hello. 
> > > > > br/>> > > I did it with a processor EExecuteGroovyScript. 
> > > > > br/>> > > The script body is somethinng like : 
> > > > > br/>> > > import
> > org.apache.http.entiity.mime.MultipartEntityBuilder 
> > > > > import org.apache.http.entity.ContentType 
> > > > > br/>> > > flowFFileList = session.get(100) 
> > > > > if(!flowFileList.isEmpty()) { 
> > > > > flowFileList.each { flowFile -> br//>> > > def multipart 
> > > > > String text = flowFile.read().getText("UTF-8") 
> > > > > br/>> > > flowFFile.write{streamIn, streamOut-> 
> > > > > multipart = MultipartEntityBuilder.create() 
> > > > > //specify multipart entries here 
> > > > > .addTextBody("object", text, 
> > > > > ContentType.APPLICATION_JSON) 
> > > > > .addBinaryBody("content", new 
> > > > > File(flowFile.'document.content.path'), 
> > > > > ContentType.create(flowFile.'document.mime.type'), 
> > > > > flowFile.'document.name') 
> > > > > .build() 
> > > > > multipart.writeTo(streamOut) 
> > > > > } 
> > > > > //set the `documentum.action.rest.content.type` attribute to 
> > > > > be used as `Content-Type` in InvokeHTTP 
> > > > > flowFile.'document.content.type' = 
> > > > > multipart.getContentType().getValue() 
> > > > > session.transfer(flowFile, REL_SUCCESS) 
> > > > > } 
> > > > > } 
> > > > > br/>> > > br/>> > > Attributes are : < 
> > > > > document.content.path : content path 
> > > > > document.mime.type : content mime type 
> > > > > document.name : binaire content name 
> > > > > br/>> > > Output update attribute < 
> > > > > document.content.type : multipart content type. 
> > > > > br/>> > > You need some extra librairries : 
> > > > > httpcore-4.4.12.jar 
> > > > > httpmime-4.5.10.jar 
> > > > > br/>> > > This will build a multipartt as the flowfile
> > content and you can 
> > > > > use it for the call after. 
> > > > > br/>> > > br/>> > > Etienne < 
> > > > > br/>> > > br/>> > > Le lun. 27 avr. 2020 à 19:21, Luis
> > Carmona < 
> > > > > lcarmona@openpartner.cl> a écrit : 
> > > > > > Hi everyone, 
> > > > > > br/>> > > > Hoping everybody is doing ok, wherever you are,
> > need some help 
> > > > > > please. 
> > > > > > br/>> > > > Does anyone has ssent a file and parameters to
> > a REST point 
> > > > > > using 
> > > > > > Invokehhtp with multipart/form-data as mime-type ? 
> > > > > > br/>> > > > I can't figure ouut how to include the -F
> > <parameter>, speaking 
> > > > > > in terms 
> > > > > > of curl syntax. 
> > > > > > br/>> > > > I really need thiis done throught NIFIso any
> > help will be highly 
> > > > > > apreciated. 
> > > > > > br/>> > > > Thanks in advancee. 
> > > > > > br/>> > > > LC < 
> > > > > > br/>> br/>> br/> < 


Re: POST multipart/form-data with Invokehttp

Posted by Otto Fowler <ot...@gmail.com>.
 No, Luis,  if the PR is accepted and lands, it will be in the next
released version of nifi after that.

If you build nifi yourself, it will be available when you build master
after it lands.

On April 27, 2020 at 13:56:36, Luis Carmona (lcarmona@openpartner.cl) wrote:

Thank you all,

Wesley and Etienne, is there any documentation source about how to
connect a script in javascript to nifi resources, InputStream,
OutputStream, Erros, and so on ?


Otto, sure I can give it a try, I am desperate for this solution. What
you mention means I have to look for a tutorial about adding a custom
processor right ?


Thanks again,

LC




On Mon, 2020-04-27 at 14:52 -0300, Wesley C. Dias de Oliveira wrote:
> Owh!
> br/>> Great, Otto!!
> br/>> Good news!!
> br/>> Em seg., 27 de abr. de 2020 às 14:50, Ottto Fowler <
> ottobackwards@gmail.com> escreveu:
> > What good timing, I just did : br/>> > https:://
github.com/apache/nifi/pull/4234
> > If you can build and try that would be sweet! or maybe a review! br/>>
> br/>> > On April 27, 2020 at 13:45:42, Etienne Jouvin ( <
> > lapinoujoujou@gmail.com) wrote:
> > > Hello.
> > > br/>> > > I did it with a processor EExecuteGroovyScript.
> > > br/>> > > The script body is somethinng like :
> > > br/>> > > import org.apache.http.entiity.mime.MultipartEntityBuilder
> > > import org.apache.http.entity.ContentType
> > > br/>> > > flowFFileList = session.get(100)
> > > if(!flowFileList.isEmpty()) {
> > > flowFileList.each { flowFile -> br//>> > > def multipart
> > > String text = flowFile.read().getText("UTF-8")
> > > br/>> > > flowFFile.write{streamIn, streamOut->
> > > multipart = MultipartEntityBuilder.create()
> > > //specify multipart entries here
> > > .addTextBody("object", text,
> > > ContentType.APPLICATION_JSON)
> > > .addBinaryBody("content", new
> > > File(flowFile.'document.content.path'),
> > > ContentType.create(flowFile.'document.mime.type'),
> > > flowFile.'document.name')
> > > .build()
> > > multipart.writeTo(streamOut)
> > > }
> > > //set the `documentum.action.rest.content.type` attribute to
> > > be used as `Content-Type` in InvokeHTTP
> > > flowFile.'document.content.type' =
> > > multipart.getContentType().getValue()
> > > session.transfer(flowFile, REL_SUCCESS)
> > > }
> > > }
> > > br/>> > > br/>> > > Attributes are : <
> > > document.content.path : content path
> > > document.mime.type : content mime type
> > > document.name : binaire content name
> > > br/>> > > Output update attribute <
> > > document.content.type : multipart content type.
> > > br/>> > > You need some extra librairries :
> > > httpcore-4.4.12.jar
> > > httpmime-4.5.10.jar
> > > br/>> > > This will build a multipartt as the flowfile content and
you can
> > > use it for the call after.
> > > br/>> > > br/>> > > Etienne <
> > > br/>> > > br/>> > > Le lun. 27 avr. 2020 à 19:21, Luis Carmona <
> > > lcarmona@openpartner.cl> a écrit :
> > > > Hi everyone,
> > > > br/>> > > > Hoping everybody is doing ok, wherever you are, need
some help
> > > > please.
> > > > br/>> > > > Does anyone has ssent a file and parameters to a REST
point
> > > > using
> > > > Invokehhtp with multipart/form-data as mime-type ?
> > > > br/>> > > > I can't figure ouut how to include the -F <parameter>,
speaking
> > > > in terms
> > > > of curl syntax.
> > > > br/>> > > > I really need thiis done throught NIFIso any help will
be highly
> > > > apreciated.
> > > > br/>> > > > Thanks in advancee.
> > > > br/>> > > > LC <
> > > > br/>> br/>> br/> <

Re: POST multipart/form-data with Invokehttp

Posted by Luis Carmona <lc...@openpartner.cl>.
Thank you all,

Wesley and Etienne, is there any documentation source about how to
connect a script in javascript to nifi resources, InputStream,
OutputStream, Erros, and so on ?


Otto, sure I can give it a try, I am desperate for this solution. What
you mention means I have to look for a tutorial about adding a custom
processor right ?


Thanks again,

LC




On Mon, 2020-04-27 at 14:52 -0300, Wesley C. Dias de Oliveira wrote:
> Owh!
> 
> Great, Otto!
> 
> Good news!
> 
> Em seg., 27 de abr. de 2020 às 14:50, Otto Fowler <
> ottobackwards@gmail.com> escreveu:
> > What good timing, I just did : 
> > https://github.com/apache/nifi/pull/4234
> > If you can build and try that would be sweet!  or maybe a review! 
> > 
> > On April 27, 2020 at 13:45:42, Etienne Jouvin (
> > lapinoujoujou@gmail.com) wrote:
> > > Hello.
> > > 
> > > I did it with a processor ExecuteGroovyScript.
> > > 
> > > The script body is something like :
> > > 
> > > import org.apache.http.entity.mime.MultipartEntityBuilder
> > > import org.apache.http.entity.ContentType
> > > 
> > > flowFileList = session.get(100)
> > > if(!flowFileList.isEmpty()) {
> > >   flowFileList.each { flowFile -> 
> > >     def multipart
> > >     String text = flowFile.read().getText("UTF-8")
> > > 
> > >     flowFile.write{streamIn, streamOut->
> > >       multipart = MultipartEntityBuilder.create()
> > >         //specify multipart entries here
> > >         .addTextBody("object", text,
> > > ContentType.APPLICATION_JSON)
> > >         .addBinaryBody("content", new
> > > File(flowFile.'document.content.path'),
> > > ContentType.create(flowFile.'document.mime.type'),
> > > flowFile.'document.name')
> > >         .build()
> > >       multipart.writeTo(streamOut)
> > >     }
> > >     //set the `documentum.action.rest.content.type` attribute to
> > > be used as `Content-Type` in InvokeHTTP
> > >     flowFile.'document.content.type' =
> > > multipart.getContentType().getValue()
> > >     session.transfer(flowFile, REL_SUCCESS)
> > >   }
> > > }
> > > 
> > > 
> > > Attributes are :
> > > document.content.path : content path
> > > document.mime.type : content mime type
> > > document.name : binaire content name
> > > 
> > > Output update attribute
> > > document.content.type : multipart content type.
> > > 
> > > You need some extra librairies :
> > > httpcore-4.4.12.jar
> > > httpmime-4.5.10.jar
> > > 
> > > This will build a multipart as the flowfile content and you can
> > > use it for the call after.
> > > 
> > > 
> > > Etienne
> > > 
> > > 
> > > Le lun. 27 avr. 2020 à 19:21, Luis Carmona <
> > > lcarmona@openpartner.cl> a écrit :
> > > > Hi everyone,
> > > > 
> > > > Hoping everybody is doing ok, wherever you are, need some help
> > > > please.
> > > > 
> > > > Does anyone has sent a file and parameters to a REST point
> > > > using
> > > > Invokehhtp with multipart/form-data as mime-type ?
> > > > 
> > > > I can't figure out how to include the -F <parameter>, speaking
> > > > in terms
> > > > of curl syntax.
> > > > 
> > > > I really need this done throught NIFIso any help will be highly
> > > > apreciated.
> > > > 
> > > > Thanks in advance.
> > > > 
> > > > LC
> > > > 
> 
> 


Re: POST multipart/form-data with Invokehttp

Posted by "Wesley C. Dias de Oliveira" <wc...@gmail.com>.
Owh!

Great, Otto!

Good news!

Em seg., 27 de abr. de 2020 às 14:50, Otto Fowler <ot...@gmail.com>
escreveu:

> What good timing, I just did : https://github.com/apache/nifi/pull/4234
> If you can build and try that would be sweet!  or maybe a review!
>
> On April 27, 2020 at 13:45:42, Etienne Jouvin (lapinoujoujou@gmail.com)
> wrote:
>
> Hello.
>
> I did it with a processor ExecuteGroovyScript.
>
> The script body is something like :
>
> import org.apache.http.entity.mime.MultipartEntityBuilder
> import org.apache.http.entity.ContentType
>
> flowFileList = session.get(100)
> if(!flowFileList.isEmpty()) {
>   flowFileList.each { flowFile ->
>     def multipart
>     String text = flowFile.read().getText("UTF-8")
>
>     flowFile.write{streamIn, streamOut->
>       multipart = MultipartEntityBuilder.create()
>         //specify multipart entries here
>         .addTextBody("object", text, ContentType.APPLICATION_JSON)
>         .addBinaryBody("content", new
> File(flowFile.'document.content.path'),
> ContentType.create(flowFile.'document.mime.type'), flowFile.'document.name
> ')
>         .build()
>       multipart.writeTo(streamOut)
>     }
>     //set the `documentum.action.rest.content.type` attribute to be used
> as `Content-Type` in InvokeHTTP
>     flowFile.'document.content.type' =
> multipart.getContentType().getValue()
>     session.transfer(flowFile, REL_SUCCESS)
>   }
> }
>
>
> Attributes are :
>
>    - document.content.path : content path
>    - document.mime.type : content mime type
>    - document.name : binaire content name
>
>
> Output update attribute
> document.content.type : multipart content type.
>
> You need some extra librairies :
>
>    - httpcore-4.4.12.jar
>    - httpmime-4.5.10.jar
>
>
> This will build a multipart as the flowfile content and you can use it for
> the call after.
>
>
> Etienne
>
>
> Le lun. 27 avr. 2020 à 19:21, Luis Carmona <lc...@openpartner.cl> a
> écrit :
>
>> Hi everyone,
>>
>> Hoping everybody is doing ok, wherever you are, need some help please.
>>
>> Does anyone has sent a file and parameters to a REST point using
>> Invokehhtp with multipart/form-data as mime-type ?
>>
>> I can't figure out how to include the -F <parameter>, speaking in terms
>> of curl syntax.
>>
>> I really need this done throught NIFIso any help will be highly
>> apreciated.
>>
>> Thanks in advance.
>>
>> LC
>>
>>

-- 
Grato,
Wesley C. Dias de Oliveira.

Linux User nº 576838.

Re: POST multipart/form-data with Invokehttp

Posted by Otto Fowler <ot...@gmail.com>.
 What good timing, I just did : https://github.com/apache/nifi/pull/4234
If you can build and try that would be sweet!  or maybe a review!

On April 27, 2020 at 13:45:42, Etienne Jouvin (lapinoujoujou@gmail.com)
wrote:

Hello.

I did it with a processor ExecuteGroovyScript.

The script body is something like :

import org.apache.http.entity.mime.MultipartEntityBuilder
import org.apache.http.entity.ContentType

flowFileList = session.get(100)
if(!flowFileList.isEmpty()) {
  flowFileList.each { flowFile ->
    def multipart
    String text = flowFile.read().getText("UTF-8")

    flowFile.write{streamIn, streamOut->
      multipart = MultipartEntityBuilder.create()
        //specify multipart entries here
        .addTextBody("object", text, ContentType.APPLICATION_JSON)
        .addBinaryBody("content", new
File(flowFile.'document.content.path'),
ContentType.create(flowFile.'document.mime.type'), flowFile.'document.name')
        .build()
      multipart.writeTo(streamOut)
    }
    //set the `documentum.action.rest.content.type` attribute to be used as
`Content-Type` in InvokeHTTP
    flowFile.'document.content.type' = multipart.getContentType().getValue()
    session.transfer(flowFile, REL_SUCCESS)
  }
}


Attributes are :

   - document.content.path : content path
   - document.mime.type : content mime type
   - document.name : binaire content name


Output update attribute
document.content.type : multipart content type.

You need some extra librairies :

   - httpcore-4.4.12.jar
   - httpmime-4.5.10.jar


This will build a multipart as the flowfile content and you can use it for
the call after.


Etienne


Le lun. 27 avr. 2020 à 19:21, Luis Carmona <lc...@openpartner.cl> a
écrit :

> Hi everyone,
>
> Hoping everybody is doing ok, wherever you are, need some help please.
>
> Does anyone has sent a file and parameters to a REST point using
> Invokehhtp with multipart/form-data as mime-type ?
>
> I can't figure out how to include the -F <parameter>, speaking in terms
> of curl syntax.
>
> I really need this done throught NIFIso any help will be highly
> apreciated.
>
> Thanks in advance.
>
> LC
>
>

Re: POST multipart/form-data with Invokehttp

Posted by Etienne Jouvin <la...@gmail.com>.
Hello.

I did it with a processor ExecuteGroovyScript.

The script body is something like :

import org.apache.http.entity.mime.MultipartEntityBuilder
import org.apache.http.entity.ContentType

flowFileList = session.get(100)
if(!flowFileList.isEmpty()) {
  flowFileList.each { flowFile ->
    def multipart
    String text = flowFile.read().getText("UTF-8")

    flowFile.write{streamIn, streamOut->
      multipart = MultipartEntityBuilder.create()
        //specify multipart entries here
        .addTextBody("object", text, ContentType.APPLICATION_JSON)
        .addBinaryBody("content", new
File(flowFile.'document.content.path'),
ContentType.create(flowFile.'document.mime.type'), flowFile.'document.name')
        .build()
      multipart.writeTo(streamOut)
    }
    //set the `documentum.action.rest.content.type` attribute to be used as
`Content-Type` in InvokeHTTP
    flowFile.'document.content.type' = multipart.getContentType().getValue()
    session.transfer(flowFile, REL_SUCCESS)
  }
}


Attributes are :

   - document.content.path : content path
   - document.mime.type : content mime type
   - document.name : binaire content name


Output update attribute
document.content.type : multipart content type.

You need some extra librairies :

   - httpcore-4.4.12.jar
   - httpmime-4.5.10.jar


This will build a multipart as the flowfile content and you can use it for
the call after.


Etienne


Le lun. 27 avr. 2020 à 19:21, Luis Carmona <lc...@openpartner.cl> a
écrit :

> Hi everyone,
>
> Hoping everybody is doing ok, wherever you are, need some help please.
>
> Does anyone has sent a file and parameters to a REST point using
> Invokehhtp with multipart/form-data as mime-type ?
>
> I can't figure out how to include the -F <parameter>, speaking in terms
> of curl syntax.
>
> I really need this done throught NIFIso any help will be highly
> apreciated.
>
> Thanks in advance.
>
> LC
>
>

Re: POST multipart/form-data with Invokehttp

Posted by Andy LoPresto <al...@apache.org>.
ExecuteProcess and ExecuteStreamCommand both allow shell commands to be run; ExecuteProcess does not allow incoming flowfiles but ExecuteStreamCommand does. 

Andy LoPresto
alopresto@apache.org
alopresto.apache@gmail.com
He/Him
PGP Fingerprint: 70EC B3E5 98A6 5A3F D3C4  BACE 3C6E F65B 2F7D EF69

> On Apr 27, 2020, at 2:31 PM, Luis Carmona <lc...@openpartner.cl> wrote:
> 
> Hi Wesley,
> 
> couldn't use Execute Processor as it doesn't receive an input FlowFile
> ( or I didn't find out how to connect it ) and I need to give to the
> procesor the file that should be sent.
> 
> Thanks anyway.
> 
> Will try with a script now.
> 
> LC
> 
> 
> 
> 
> On Mon, 2020-04-27 at 14:26 -0300, Wesley C. Dias de Oliveira wrote:
>> Hello, Luis.
>> 
>> Have you tried to send with ExecuteProcessor?
>> 
>> 
>> 
>> Using that way you can invoke curl explicit to run your command.
>> 
>> Em seg., 27 de abr. de 2020 às 14:21, Luis Carmona <
>> lcarmona@openpartner.cl> escreveu:
>>> Hi everyone,
>>> 
>>> Hoping everybody is doing ok, wherever you are, need some help
>>> please.
>>> 
>>> Does anyone has sent a file and parameters to a REST point using
>>> Invokehhtp with multipart/form-data as mime-type ?
>>> 
>>> I can't figure out how to include the -F <parameter>, speaking in
>>> terms
>>> of curl syntax.
>>> 
>>> I really need this done throught NIFIso any help will be highly
>>> apreciated.
>>> 
>>> Thanks in advance.
>>> 
>>> LC
>>> 
>> 
>> 
> 


Re: POST multipart/form-data with Invokehttp

Posted by Luis Carmona <lc...@openpartner.cl>.
Hi Wesley,

couldn't use Execute Processor as it doesn't receive an input FlowFile
( or I didn't find out how to connect it ) and I need to give to the
procesor the file that should be sent.

Thanks anyway.

Will try with a script now.

LC




On Mon, 2020-04-27 at 14:26 -0300, Wesley C. Dias de Oliveira wrote:
> Hello, Luis.
> 
> Have you tried to send with ExecuteProcessor?
> 
> 
> 
> Using that way you can invoke curl explicit to run your command.
> 
> Em seg., 27 de abr. de 2020 às 14:21, Luis Carmona <
> lcarmona@openpartner.cl> escreveu:
> > Hi everyone,
> > 
> > Hoping everybody is doing ok, wherever you are, need some help
> > please.
> > 
> > Does anyone has sent a file and parameters to a REST point using
> > Invokehhtp with multipart/form-data as mime-type ?
> > 
> > I can't figure out how to include the -F <parameter>, speaking in
> > terms
> > of curl syntax.
> > 
> > I really need this done throught NIFIso any help will be highly
> > apreciated.
> > 
> > Thanks in advance.
> > 
> > LC
> > 
> 
> 


Re: POST multipart/form-data with Invokehttp

Posted by Luis Carmona <lc...@openpartner.cl>.
Hi Wesley,

no, haven't used any processor related to do things out of NIFI itself.

Will give it a try thanks.

LC



On Mon, 2020-04-27 at 14:26 -0300, Wesley C. Dias de Oliveira wrote:
> Hello, Luis.
> 
> Have you tried to send with ExecuteProcessor?
> 
> 
> 
> Using that way you can invoke curl explicit to run your command.
> 
> Em seg., 27 de abr. de 2020 às 14:21, Luis Carmona <
> lcarmona@openpartner.cl> escreveu:
> > Hi everyone,
> > 
> > Hoping everybody is doing ok, wherever you are, need some help
> > please.
> > 
> > Does anyone has sent a file and parameters to a REST point using
> > Invokehhtp with multipart/form-data as mime-type ?
> > 
> > I can't figure out how to include the -F <parameter>, speaking in
> > terms
> > of curl syntax.
> > 
> > I really need this done throught NIFIso any help will be highly
> > apreciated.
> > 
> > Thanks in advance.
> > 
> > LC
> > 
> 
> 


Re: POST multipart/form-data with Invokehttp

Posted by "Wesley C. Dias de Oliveira" <wc...@gmail.com>.
Hello, Luis.

Have you tried to send with ExecuteProcessor?

[image: image.png]

Using that way you can invoke curl explicit to run your command.

Em seg., 27 de abr. de 2020 às 14:21, Luis Carmona <lc...@openpartner.cl>
escreveu:

> Hi everyone,
>
> Hoping everybody is doing ok, wherever you are, need some help please.
>
> Does anyone has sent a file and parameters to a REST point using
> Invokehhtp with multipart/form-data as mime-type ?
>
> I can't figure out how to include the -F <parameter>, speaking in terms
> of curl syntax.
>
> I really need this done throught NIFIso any help will be highly
> apreciated.
>
> Thanks in advance.
>
> LC
>
>

-- 
Grato,
Wesley C. Dias de Oliveira.

Linux User nº 576838.