Support Questions

Find answers, ask questions, and share your expertise
Announcements
Celebrating as our community reaches 100,000 members! Thank you!

Nifi InvokeHTTP failure response

avatar
New Contributor

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.

1 ACCEPTED SOLUTION

avatar
Contributor

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 .

HTTPErrorAndMessage.PNG

 

ReplaceText processor properties 

ReplaceText#.PNG

 

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  

View solution in original post

2 REPLIES 2

avatar
Contributor

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 .

HTTPErrorAndMessage.PNG

 

ReplaceText processor properties 

ReplaceText#.PNG

 

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  

avatar
New Contributor

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.