Created 12-16-2024 10:14 PM
Hello sir,
I am using the InvokeHTTP processor in Apache NiFi to call an API. I am writing the response using the PutFile processor. When the API returns a 200 status code, it works fine and writes the response. However, when the API returns a 400 or 500 status code, it writes the original input file instead. I want to capture and write the actual response body for 400 or 500 status codes instead of the input file. here is process:
here is InvokeHTTP processor:
Here is putfile processor:
if status 200 it write the response . I want write all response from api instead of input file if it has any status from api.
Please help me
Created 12-19-2024 11:07 PM
@enam
I see you have used the correct InvokeHTTP processor which is used to send API requests and handle responses, including error codes 400, 500 etc.
To enable Error Responses add the following settings:
Now route Responses Based on Status Code
Connect the InvokeHTTP processor's Response relationship to the RouteOnAttribute processor.
To write Responses to Appropriate Locations
Include response details for debugging.
Important Configuration Notes
Configure Failure Handling in InvokeHTTP:
Customize Filenames or Attributes:
Capture Full API Responses:
Can you run the above flow and revert
Happy hadooping
Created 12-25-2024 09:50 PM
Hi @Shelton sorry for late reply:
Here is my json response 400:
Here is invoke HTTP: I have used below properties in invokhttp like below:
Here is RouteOnAttribute:
Is it like that?