Skip to main content
rajivswe_2k7
Silver ⭐️⭐️⭐️
October 22, 2024
Solved

Nifi: InvokeHttp process for all 4xx HTTP status codes 'invokehttp.response.body'. hold only maximum 256.

When using the InvokeHttp process for all 4xx HTTP status codes, we receive the HTTP response in the request flow file attribute 'invokehttp.response.body'. However, the attribute holds only 256 characters, and any response bigger than that causes truncation.

I would like to hold the entire response body , even it is beyond 256 chars for 4xx status code.

drewski7
drewski7Answer
Gold ⭐️⭐️
October 22, 2024

@rajivswe_2k7 

I would avoid putting a lot of data in the flowfile attributes due to memory concerns. However, what you could do is change the property in the InvokeHTTP called "Response Generation Required" from False to True

drewski7_1-1729607623675.png

No matter what the status code of the HTTP response is , it will automatically get routed to the Response relationship with the full content of the response in the flowfile's content along with the response status code in the flowfile's attribute. 

You could then use a RouteOnAttribute Processor to filter for certain response codes and you will have your full response in the content of the flowfile where it should be 🙂

Please accept this solution if you find it to be helpful! 

 

3 replies

drewski7
drewski7Answer
Gold ⭐️⭐️
October 22, 2024

@rajivswe_2k7 

I would avoid putting a lot of data in the flowfile attributes due to memory concerns. However, what you could do is change the property in the InvokeHTTP called "Response Generation Required" from False to True

drewski7_1-1729607623675.png

No matter what the status code of the HTTP response is , it will automatically get routed to the Response relationship with the full content of the response in the flowfile's content along with the response status code in the flowfile's attribute. 

You could then use a RouteOnAttribute Processor to filter for certain response codes and you will have your full response in the content of the flowfile where it should be 🙂

Please accept this solution if you find it to be helpful! 

 

Translate
rajivswe_2k7
Silver ⭐️⭐️⭐️
October 23, 2024

Thank you  @drewski7

It is working for me with expected output. Thank you. 

 

Translate
rajivswe_2k7
Silver ⭐️⭐️⭐️
October 23, 2024

rajivswe_2k7_0-1729661081105.pngrajivswe_2k7_1-1729661116041.pngrajivswe_2k7_2-1729661170436.png

 

Translate