Created 07-01-2021 07:26 AM
Hi,
I am using invokeHTTP processor for calling REST API when that REST api gives error like 422 or other it is also sending reason in response body.
I want to retrieve that message and send it on mail but on this kind of error flow go into retry or no retry which gives me original flow file only.
Can anyone pls help me to retrieve response body in this case instead of original flow file.
Thanks in Advanced.
Created on 07-01-2021 12:45 PM - edited 07-01-2021 12:46 PM
Hi ,
The InvokeHTTP processor provides couple of the write attributes with value for example invokehttp.status.code
401
invokehttp.status.message
Unauthorized
when you have this attributes in Failure or No Retry relationship ,you can use Replace text processor as below to overwrite the original flow into new flow file so that you send that in email .
ReplaceText processor properties
If you are looking for lot more message of the response body , please check whether you can configure in any attribute in InvokeHTTP processor so that you can use it ReplaceText processor to overwrite the original flow file
Created on 07-01-2021 12:45 PM - edited 07-01-2021 12:46 PM
Hi ,
The InvokeHTTP processor provides couple of the write attributes with value for example invokehttp.status.code
401
invokehttp.status.message
Unauthorized
when you have this attributes in Failure or No Retry relationship ,you can use Replace text processor as below to overwrite the original flow into new flow file so that you send that in email .
ReplaceText processor properties
If you are looking for lot more message of the response body , please check whether you can configure in any attribute in InvokeHTTP processor so that you can use it ReplaceText processor to overwrite the original flow file
Created 07-09-2021 05:03 AM
Hi adhisankrit,
thanks a lot for help, i am new to NIFI.
this solution worked.
Basically their are write attributes present in processor where status and response etc stuff are present which can be accessed.