RE: [RMX:NL] Fw: [RMX:NL] Re: [RMX:NL] Re: [RMX:NL] Re: InvokeHTTP request parameters
Thank you Joe James -Original Message- From: Joe Percivall [mailto:joeperciv...@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: joeperciv...@yahoo.com On Friday, December 18, 2015 5:20 PM, Joe Percivall <joeperciv...@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}=${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: joeperciv...@yahoo.com On Friday, December 18, 2015 5:03 PM, Burrows James A <james.burr...@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}=${MessageBody}) With the example template you provided it would be http://localhost/submit?Identifier=${MessageIdentifier}=${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}=${MessageBody} HTTP/1.1 Host: localhost Vs POST /submit HTTP/1.1 Host: localhost Identifier=${MessageIdentifier}=${MessageBody} James -Original Message- From: Joe Percivall [mailto:joeperciv...@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: joeperciv...@yahoo.com On Friday, December 18, 2015 4:39 PM, Burrows James A <james.burr...@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:joeperciv...@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: joeperciv...@yahoo.com On Friday, December 18, 2015 4:28 PM, Burrows James A <james.burr...@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:joeperciv...@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}=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
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: joeperciv...@yahoo.com On Friday, December 18, 2015 5:20 PM, Joe Percivallwrote: 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}=${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: joeperciv...@yahoo.com On Friday, December 18, 2015 5:03 PM, Burrows James A 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}=${MessageBody}) With the example template you provided it would be http://localhost/submit?Identifier=${MessageIdentifier}=${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}=${MessageBody} HTTP/1.1 Host: localhost Vs POST /submit HTTP/1.1 Host: localhost Identifier=${MessageIdentifier}=${MessageBody} James -Original Message- From: Joe Percivall [mailto:joeperciv...@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: joeperciv...@yahoo.com On Friday, December 18, 2015 4:39 PM, Burrows James A 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:joeperciv...@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: joeperciv...@yahoo.com On Friday, December 18, 2015 4:28 PM, Burrows James A 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:joeperciv...@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}=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: joeperciv...@yahoo.com On Friday, December 18, 2015 3:32 PM, Burrows James A wrote: Yes the HTTP call being generated is sending without the query string