In addition to the response parameter, each REST Adapter call also provides the complete adapter response as an output object. The adapter response contains the following:
DeprecatedThis attribute is deprecated. It is only present for compatibility reasons.
Please use httpHeaderMap (see below) for new implementations. The implementation of httpHeaderMap complies to the HTTP specification and supports multiple headers having the same name.
body
Blob
HTTP body of HTTP response. Among others, the body contains
the responseObject for successful calls
an object of the RESTError class if the call has not been successful.
responseObject
Any
Response Object of the REST adapter call if the endpoint returns one (response output parameter).
The response object is only returned for successful calls.
Header information as a map. The map contains arrays of header value strings whereas the header name is the key of the map.
Header names are lowercase and treated case insensitive.
Multiple headers with the same name are treated as arrays.
Refer to HTTP Header Support for more information on the standard xUML HTTP headers.
You can get the adapter response from the adapterResponse pin of the adapter.
Example
The following example shows how to get theREST error object in case of error and log it to the service log.
The adapter response is taken from the corresponding pin and transferred to a local object. The object does not necessarily need to be called adapterResponse - you can name it as you like. Next, in case of error, the response is provided to an operation (logRESTError) that logs the error.
This operation takes the the adapter response from the response body and transforms it using action script (getResponseObjectFromBody). Parameter return is of type RESTError, a type that has been imported with the OpenAPI descriptor.
set return = adapterResponse.body.transcodeToString("ISO-8859-1").jsonToClass();
This error object is provided as details parameter to the logger.
The error code to be logged is taken from the HTTP status code of the adapter response as described on Transforming Data on an Object Flow, using the following action script snippet: