REST API - Response Error

REST API - Response Error

 I am utilizing the Zipcode API ( to test out REST.  I have been able to consume the API just fine, however, I am having a hard time utilizing the response text for errors in an Exception Handler.  I have looked at all of the documentation and even went as far as utilizing the OnAfterResponse action but I cannot seem to replace the feedback message with the response text for the error.  How is this accomplished?
Hi Chris,

There are 2 ways to do it::

The easiest way is to add the OnAfterResponse and check for a status code >= 400, and then use ardoJson component to select the error_msg field from the ResponseText using the ardoJSON.JSONSelect method.
If all you want is the feedback message with the correct text just raise a Exception after that with the text.

Another way to do it (but not as centralized) is to just add a error_msg text attribute to the response structures.
Then in the OnAfterResponse just change the status code in the CustomizedResponse to 200 (so it doesn't throw any error)
That way you can check for the error_msg <> "" after each call and handle it any way you need.

Tell me if how it goes.

João Rosado