You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@nifi.apache.org by anup s <an...@philips.com> on 2015/04/30 06:34:57 UTC

Invoke HTTP POST

Hi, 
   I have a REST service that needs to be invoked with a  few input
parameters like filename and appName. I was able to call this REST service
from NiFi through 'InvokeHTTP' processor by sending the parameters as part
of the URL:
"http://<ip>:<port>/app/context?filename=<filename>&appName=<appName>

Now I need to use POST to do the same and send the parameters in the body
part. How do I achieve this?

METHOD: POST
URL: http://<ip>:<port>/app/context

Where do i send the parameters filename and appName?


Regards,
anup



--
View this message in context: http://apache-nifi-incubating-developer-list.39713.n7.nabble.com/Invoke-HTTP-POST-tp1290.html
Sent from the Apache NiFi (incubating) Developer List mailing list archive at Nabble.com.

Re: Invoke HTTP POST

Posted by Aldrin Piri <al...@gmail.com>.
Good call.  Issue is here: https://issues.apache.org/jira/browse/NIFI-564

Anup,

As an attachment on that issue, please also find a generated template that
captures my understanding of what you are trying to do and let me know if
something seems incorrect in that interpretation.




On Thu, Apr 30, 2015 at 10:44 AM, Joe Witt <jo...@gmail.com> wrote:

> How about starting a jira and attach templates to it?
> On Apr 30, 2015 6:40 AM, "Aldrin Piri" <al...@gmail.com> wrote:
>
> > Anup,
> >
> > Could you be more explicit in how and what is failing?  Is it the
> > ReplaceText? Is it the receiving web endpoint to which the POST is being
> > made?  Are there any logs/bulletins that provide additional context?
> >
> > I have a similar set up and seem to be getting the results I would
> expect:
> > Regular Expression:  (.*)
> > Replacement Value: filename=${path}${filename}&appName=${appName}
> > Character Set:  UTF-8
> > Maximum Buffer Size: 1 MB
> > Evaluation Mode: Entire text
> >
> > This ReplaceText is done after a GenerateFlowFile and UpdateAttribute
> which
> > specifies an appName.
> >
> > Also, are the *'s around your Replacement Value something you have added
> or
> > is that some formatting from the email?  In the case of the prior, they
> are
> > not needed.
> >
> > On Thu, Apr 30, 2015 at 3:05 AM, anup s <an...@philips.com>
> wrote:
> >
> > > I tried doing that with the below entries.. but its failing.
> > >
> > > Regular ExpressionInfo = (.*)
> > > Replacement ValueInfo = *appName=myApp&filename=${path}${filename}*
> > > Character SetInfo = UTF-8
> > > Maximum Buffer SizeInfo = 1 MB
> > > Evaluation ModeInfo = Entire text
> > >
> > > How would these be treated as form parameters?
> > >
> > >
> > >
> > > --
> > > View this message in context:
> > >
> >
> http://apache-nifi-incubating-developer-list.39713.n7.nabble.com/Invoke-HTTP-POST-tp1290p1293.html
> > > Sent from the Apache NiFi (incubating) Developer List mailing list
> > archive
> > > at Nabble.com.
> > >
> >
>

Re: Invoke HTTP POST

Posted by Joe Witt <jo...@gmail.com>.
How about starting a jira and attach templates to it?
On Apr 30, 2015 6:40 AM, "Aldrin Piri" <al...@gmail.com> wrote:

> Anup,
>
> Could you be more explicit in how and what is failing?  Is it the
> ReplaceText? Is it the receiving web endpoint to which the POST is being
> made?  Are there any logs/bulletins that provide additional context?
>
> I have a similar set up and seem to be getting the results I would expect:
> Regular Expression:  (.*)
> Replacement Value: filename=${path}${filename}&appName=${appName}
> Character Set:  UTF-8
> Maximum Buffer Size: 1 MB
> Evaluation Mode: Entire text
>
> This ReplaceText is done after a GenerateFlowFile and UpdateAttribute which
> specifies an appName.
>
> Also, are the *'s around your Replacement Value something you have added or
> is that some formatting from the email?  In the case of the prior, they are
> not needed.
>
> On Thu, Apr 30, 2015 at 3:05 AM, anup s <an...@philips.com> wrote:
>
> > I tried doing that with the below entries.. but its failing.
> >
> > Regular ExpressionInfo = (.*)
> > Replacement ValueInfo = *appName=myApp&filename=${path}${filename}*
> > Character SetInfo = UTF-8
> > Maximum Buffer SizeInfo = 1 MB
> > Evaluation ModeInfo = Entire text
> >
> > How would these be treated as form parameters?
> >
> >
> >
> > --
> > View this message in context:
> >
> http://apache-nifi-incubating-developer-list.39713.n7.nabble.com/Invoke-HTTP-POST-tp1290p1293.html
> > Sent from the Apache NiFi (incubating) Developer List mailing list
> archive
> > at Nabble.com.
> >
>

Re: Invoke HTTP POST

Posted by Aldrin Piri <al...@gmail.com>.
Anup,

Could you be more explicit in how and what is failing?  Is it the
ReplaceText? Is it the receiving web endpoint to which the POST is being
made?  Are there any logs/bulletins that provide additional context?

I have a similar set up and seem to be getting the results I would expect:
Regular Expression:  (.*)
Replacement Value: filename=${path}${filename}&appName=${appName}
Character Set:  UTF-8
Maximum Buffer Size: 1 MB
Evaluation Mode: Entire text

This ReplaceText is done after a GenerateFlowFile and UpdateAttribute which
specifies an appName.

Also, are the *'s around your Replacement Value something you have added or
is that some formatting from the email?  In the case of the prior, they are
not needed.

On Thu, Apr 30, 2015 at 3:05 AM, anup s <an...@philips.com> wrote:

> I tried doing that with the below entries.. but its failing.
>
> Regular ExpressionInfo = (.*)
> Replacement ValueInfo = *appName=myApp&filename=${path}${filename}*
> Character SetInfo = UTF-8
> Maximum Buffer SizeInfo = 1 MB
> Evaluation ModeInfo = Entire text
>
> How would these be treated as form parameters?
>
>
>
> --
> View this message in context:
> http://apache-nifi-incubating-developer-list.39713.n7.nabble.com/Invoke-HTTP-POST-tp1290p1293.html
> Sent from the Apache NiFi (incubating) Developer List mailing list archive
> at Nabble.com.
>

Re: Invoke HTTP POST

Posted by anup s <an...@philips.com>.
I tried doing that with the below entries.. but its failing.

Regular ExpressionInfo = (.*)
Replacement ValueInfo = *appName=myApp&filename=${path}${filename}*
Character SetInfo = UTF-8
Maximum Buffer SizeInfo = 1 MB
Evaluation ModeInfo = Entire text

How would these be treated as form parameters? 



--
View this message in context: http://apache-nifi-incubating-developer-list.39713.n7.nabble.com/Invoke-HTTP-POST-tp1290p1293.html
Sent from the Apache NiFi (incubating) Developer List mailing list archive at Nabble.com.

Re: Invoke HTTP POST

Posted by Aldrin Piri <al...@gmail.com>.
HI anup,

If I understand correctly, you are looking to do a POST that falls in line
with a Content-Type of application/x-www-form-urlencoded.

Under this assumption, I believe you could get the execution process you
desire by performing a replace text of a file with your desired query
parameters, each having their desired value populated using Expression
Language from other attributes.  You could then use an UpdateAttribute
processor to specify the Content-Type of
application/x-www-form-urlencoded.  Finally, pass this file to an
InvokeHTTP as you suspect, and ensure that Content-Type is one of the
included attributes as a header.

On Thu, Apr 30, 2015 at 12:34 AM, anup s <an...@philips.com> wrote:

> Hi,
>    I have a REST service that needs to be invoked with a  few input
> parameters like filename and appName. I was able to call this REST service
> from NiFi through 'InvokeHTTP' processor by sending the parameters as part
> of the URL:
> "http://<ip>:<port>/app/context?filename=<filename>&appName=<appName>
>
> Now I need to use POST to do the same and send the parameters in the body
> part. How do I achieve this?
>
> METHOD: POST
> URL: http://<ip>:<port>/app/context
>
> Where do i send the parameters filename and appName?
>
>
> Regards,
> anup
>
>
>
> --
> View this message in context:
> http://apache-nifi-incubating-developer-list.39713.n7.nabble.com/Invoke-HTTP-POST-tp1290.html
> Sent from the Apache NiFi (incubating) Developer List mailing list archive
> at Nabble.com.
>