You're almost there! Please answer a few more questions for access to the Applications content. Complete registration
Interested in joining? Complete your registration by providing Areas of Interest here. Register

How to parse error body in REST API call with Groovy?

in Sales 2 comments

Summary:

Good afternoon. Hope you can help me out. We have a Groovy script in our Fusion environment that sends a REST call. Once in a while we will receive an error from the downstream application that will return a 500 or 400. I would like to print the error message from the downstream application to the User using a ValidationException(). Is there a function/property to retrieve the error from the REST response?

Content (please ensure you mask any confidential information):

In the code below. printing out the Exception does not include the actual REST response body. Here is a copy of the message from my code:

Howdy, Stranger!

Log In

To view full details, sign in.

Register

Don't have an account? Click here to get started!