nifi-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Burrows James A <James.Burr...@dematic.com>
Subject RE: [RMX:NL] Fw: [RMX:NL] Re: [RMX:NL] Re: [RMX:NL] Re: InvokeHTTP request parameters
Date Mon, 21 Dec 2015 16:20:21 GMT
Thank you Joe

James

-----Original Message-----
From: Joe Percivall [mailto:joepercivall@yahoo.com] 
Sent: Friday, December 18, 2015 3:34 PM
To: Users
Subject: [RMX:NL] Fw: [RMX:NL] Re: [RMX:NL] Re: [RMX:NL] Re: InvokeHTTP request parameters

I accidentally replied to just James with one of my responses. Forwarding the thread back.
 - - - - - - 
Joseph Percivall
linkedin.com/in/Percivall
e: joepercivall@yahoo.com




On Friday, December 18, 2015 5:20 PM, Joe Percivall <joepercivall@yahoo.com> wrote:
Following this post[1] on sending and retrieving HTTP form data I believe I know what you
want to do.

The variables should be sent as the body of the POST request. The InvokeHttp processor POSTs
whatever the content of the FlowFile is. You'll need to add a ReplaceText processor before
InvokeHttp that replaces the entire content of the FlowFile with the value you want to send.


The default configuration for the ReplaceText processor is to replace the entire contents
so you should just be able to change the "Replacement Value" property to "Identifier=${MessageIdentifier}&Body=${MessageBody}".

[1] https://developer.mozilla.org/en-US/docs/Web/Guide/HTML/Forms/Sending_and_retrieving_form_data

Sorry, I am not versed in the terminology for sending forms via HTTP but hope this works,
Joe
- - - - - - 
Joseph Percivall
linkedin.com/in/Percivall
e: joepercivall@yahoo.com





On Friday, December 18, 2015 5:03 PM, Burrows James A <James.Burrows@dematic.com> wrote:
This is what I currently have:

Get a message from a kafka queue which may contain multiple messages in an array ->
Split the messages into separate flow files ->
Create some attributes from each message so I can access them (MessageIdentifier, MessageBody)
->
POST the message to a rest api (Identifier=${MessageIdentifier}&Body=${MessageBody})

With the example template you provided it would be http://localhost/submit?Identifier=${MessageIdentifier}&Body=${MessageBody}
for a GET request, but I need them to be in form variables since the rest api is a POST method

IE. 
GET /submit?Identifier=${MessageIdentifier}&Body=${MessageBody} HTTP/1.1
Host: localhost

Vs

POST /submit HTTP/1.1
Host: localhost
Identifier=${MessageIdentifier}&Body=${MessageBody}

James


-----Original Message-----
From: Joe Percivall [mailto:joepercivall@yahoo.com] 
Sent: Friday, December 18, 2015 2:51 PM
To: Burrows James A
Subject: Re: [RMX:NL] Re: [RMX:NL] Re: [RMX:NL] Re: InvokeHTTP request parameters

The only parsing of the URL that InvokeHTTP does is analyze it for the protocol (http or https)
and for expression language (EL), like had in the template (${q}). Aside from that, what ever
URL is is where the request will be routed to.

When you say variables, do you mean request headers? If so there are a couple different ways
to add them that I can explain depending on how you want to configure it (attributes of the
incoming flowfiles, same header every time, etc.).

Sorry just having a little trouble figuring out what you mean but I'm happy to work through
it with you, Joe

- - - - - -
Joseph Percivall
linkedin.com/in/Percivall
e: joepercivall@yahoo.com




On Friday, December 18, 2015 4:39 PM, Burrows James A <James.Burrows@dematic.com> wrote:
Is it supposed to parse out the query string from the url, and convert the parameters to form
variables?
I tried converting the method to POST, but they still came across as GET parameters.

Thanks again, I've been stuck on this for days.

James


-----Original Message-----
From: Joe Percivall [mailto:joepercivall@yahoo.com] 
Sent: Friday, December 18, 2015 2:32 PM
To: Burrows James A
Subject: Re: [RMX:NL] Re: [RMX:NL] Re: [RMX:NL] Re: InvokeHTTP request parameters

Awesome! Glad to hear that fixed it and sorry I linked you to an incorrect template.

For other HTTP methods just change the "HTTP Method" property to your desired method.

Joe
- - - - - - 
Joseph Percivall
linkedin.com/in/Percivall
e: joepercivall@yahoo.com




On Friday, December 18, 2015 4:28 PM, Burrows James A <James.Burrows@dematic.com> wrote:
Thanks for updating the template it worked perfect for GET methods.
I'm now curious how I would do the same thing for POST,PUT,DELETE methods?

James


-----Original Message-----
From: Joe Percivall [mailto:joepercivall@yahoo.com] 
Sent: Friday, December 18, 2015 1:58 PM
To: users@nifi.apache.org
Subject: [RMX:NL] Re: [RMX:NL] Re: [RMX:NL] Re: InvokeHTTP request parameters

Apparently that template doesn't actually do what it said it did. It wasn't using the "q"
attribute in the URL so it was just hitting google without any query.

I just pushed out a change to the repo which fixes it to properly hit "http://www.google.com/search?q=${q}&rct=j"
where the ${q} is replace with the attribute that's created in the previous processor. The
"rct=j" was just part of the url when I did manual google search in my browser and allowed
me to do the search in NiFi as well.

I'll be changing on Confluence as well.

Sorry about that,
Joe
- - - - - - 
Joseph Percivall
linkedin.com/in/Percivall
e: joepercivall@yahoo.com




On Friday, December 18, 2015 3:32 PM, Burrows James A <James.Burrows@dematic.com> wrote:
Yes the HTTP call being generated is sending without the query string values.
For the configuration of my InvokeHTTP I used that template, but changed the remote URL to
point to my server (https://www.google.com -> http://localhost).

James


-----Original Message-----
From: Joe Percivall [mailto:joepercivall@yahoo.com] 
Sent: Friday, December 18, 2015 1:25 PM
To: users@nifi.apache.org
Subject: [RMX:NL] Re: [RMX:NL] Re: InvokeHTTP request parameters

Yeah I compiled from the wiki as well. I want to get a listing of as many templates as possible
so when someone needs an example template I/we can check the excel doc to see which processors
are used in which template. Still working on generating more content though.

Are you saying that the HTTP call you're generating in InvokeHttp is arriving at the server
without any query string values? 

If that's the case and you're able, can you reply with your InvokeHttp config?

Joe
- - - - - - 
Joseph Percivall
linkedin.com/in/Percivall
e: joepercivall@yahoo.com




On Friday, December 18, 2015 3:16 PM, Burrows James A <James.Burrows@dematic.com> wrote:
Thanks for the reply.

That appears the be the same template from the wiki, and it seems like it should work, but
when I get the request on the server there are no querystring values.


-----Original Message-----
From: Joe Percivall [mailto:joepercivall@yahoo.com] 
Sent: Friday, December 18, 2015 12:58 PM
To: users@nifi.apache.org
Subject: [RMX:NL] Re: InvokeHTTP request parameters

Hello James,

I'm actually working on repo that includes many different templates. There are a few that
have InvokeHttp in them (can find the exact ones using the excel doc at the top level) but
this is a simple one that uses InvokeHttp:

https://github.com/hortonworks-gallery/nifi-templates/blob/master/templates/InvokeHttp_And_Route_Original_On_Status.xml


Does that fit your use-case?

Joe
- - - - - - 
Joseph Percivall
linkedin.com/in/Percivall
e: joepercivall@yahoo.com



On Friday, December 18, 2015 2:52 PM, Burrows James A <James.Burrows@dematic.com> wrote:




I’m wondering if anyone has a sample, or tutorial on how to configure the InvokeHTTP request
parameters.
I see that you can configure the request headers using the Attributes to Send property, but
I need to be able to specify the request parameters to integrate with a rest api.


Thanks,
James
Mime
View raw message