Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Published by Scroll Versions from space WDESIGNER and version 24.0

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:

Multiexcerpt include
MultiExcerptNameAdapterResponse
PageWithExcerptREST Adapter Reference

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.

Using transcodeToString() and jsonToClass(), the body content is transformed to the error object.

Code Block
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:

Code Block
adapterResponse.httpStatus.convertToString()
rp
Panel
titleRelated Pages: