Turning off 404 logging for consumed rest API

Turning off 404 logging for consumed rest API

  

Hey there,


I'm consuming a rest API that is used to check if a certain serial number is valid or not. This API returns 404 error if the serial number is not found and the user gets prompted that this is not a valid number. 


My problem is that i'm unable to turn off this 404 error being logged into service center. The application has about 10k lookups a day so the logs are getting full of these 404 logs that have no value for anyone.


I've added an exception handler to the function with the "log error" turned to false but that does not work. The error that is logged comes from the web service it self. 



Is there a way for me to customize the logging ? So I only log e.g the 500 errors ?

Solution

Hi Tomas,

You can use the OnAfterResponse action (Add it to your rest consumed service).

You can than replace the code and return the result with the new code.

Not entirely sure, but I think this will solve this problem, as I "think" the server will evaluate the returned result after this.

Cheers

Solution

Nice solution :) and it worked !


So what I did is I check if its a 404, if so I change the status code to 200 and validate the return object in the consumer function.