Re: InvokeHTTP & AttributesToJSON Help

2020-02-02 Thread Darren Govoni
Ok, thanks!

From: Etienne Jouvin 
Sent: Saturday, February 1, 2020 4:22 PM
To: users@nifi.apache.org 
Subject: Re: InvokeHTTP & AttributesToJSON Help

Hi.

If I well understand, you can configure the InvokeHTTP to always output the 
response.
In this case, the response will be routed to the response relation in any case.
Then yo ucan do a RouteOnAttribute to check the response status. And if HTTP 
code, from attribute, is 500 go to a specific relation, if 200 to other and so 
on.
But be careful, retry, error relation are still active. So you can auto finish 
on them and just work from the response relation.

Etienne


Le sam. 1 févr. 2020 à 15:26, Darren Govoni 
mailto:dar...@ontrenet.com>> a écrit :
Hi,
  I have probably 2 easy problems I can't seem to solve (still new).


  1.  I want to route a status 500 to Failure. Not retry. The response contains 
a JSON message.
  2.  Currently, I am routing the InvokeHTTP Retry with code 500 to 
AttributesToJSON to pull the response JSON from "invokehttp.response.body" and 
put it as the flow file. However, it does not work the way I expect.
 *   I want the response body to become the flow file. Instead I get
*   { "invokehttp.response.body": "my json encoded json response" }
*   I do not want the outer "invokehttp.response.body" field
  3.  I then tried to unwrap this using SplitJSON, but I cannot seems to use 
this JSON path
 *   $.invokehttp.response.body - Because the dot notation used by Nifi has 
different semantics to JSONPath.

Any easy fixes to these conundrums?

thank you!
D


Re: InvokeHTTP & AttributesToJSON Help

2020-02-01 Thread Etienne Jouvin
Hi.

If I well understand, you can configure the InvokeHTTP to always output the
response.
In this case, the response will be routed to the response relation in any
case.
Then yo ucan do a RouteOnAttribute to check the response status. And if
HTTP code, from attribute, is 500 go to a specific relation, if 200 to
other and so on.
But be careful, retry, error relation are still active. So you can auto
finish on them and just work from the response relation.

Etienne


Le sam. 1 févr. 2020 à 15:26, Darren Govoni  a écrit :

> Hi,
>   I have probably 2 easy problems I can't seem to solve (still new).
>
>
>1. I want to route a status 500 to Failure. Not retry. The response
>contains a JSON message.
>2. Currently, I am routing the InvokeHTTP Retry with code 500 to
>AttributesToJSON to pull the response JSON from "invokehttp.response.body"
>and put it as the flow file. However, it does not work the way I expect.
>   1. I want the response body to become the flow file. Instead I get
>  1. { "invokehttp.response.body": "my json encoded json response"
>  }
>  2. I do not want the outer "invokehttp.response.body" field
>   3. I then tried to unwrap this using SplitJSON, but I cannot seems
>to use this JSON path
>   1. $.invokehttp.response.body - Because the dot notation used by
>   Nifi has different semantics to JSONPath.
>
> Any easy fixes to these conundrums?
>
> thank you!
> D
>


InvokeHTTP & AttributesToJSON Help

2020-02-01 Thread Darren Govoni
Hi,
  I have probably 2 easy problems I can't seem to solve (still new).


  1.  I want to route a status 500 to Failure. Not retry. The response contains 
a JSON message.
  2.  Currently, I am routing the InvokeHTTP Retry with code 500 to 
AttributesToJSON to pull the response JSON from "invokehttp.response.body" and 
put it as the flow file. However, it does not work the way I expect.
 *   I want the response body to become the flow file. Instead I get
*   { "invokehttp.response.body": "my json encoded json response" }
*   I do not want the outer "invokehttp.response.body" field
  3.  I then tried to unwrap this using SplitJSON, but I cannot seems to use 
this JSON path
 *   $.invokehttp.response.body - Because the dot notation used by Nifi has 
different semantics to JSONPath.

Any easy fixes to these conundrums?

thank you!
D