Versions Compared

Key

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

...

Find below an overview on the REST methods provided by the example:

ResourceREST MethodDescriptionTag httpMethodInputIn viaOutput (body)
supportcasesGETget a support case overviewGET or blanknoneSupportCaseInfo, a complex object containing some general information on the resource.
In the example, these are number of support requests and a list of customers afflicted by support cases.
GET/query support casesGET or blanknone

ListOfSupportCases

Note
iconfalse

Output parameters should be of complex type. Arrays are allowed but not accepted by all clients, so the compiler will throw a warning. Better wrap the array in a complex type:

Image Modified

statusquery
customerNamequery
POSTcreate a new support requestPOSTSupportCasebodySupportCase
supportcaseGETget a specific support caseGET or blankidpathSupportCase
DELETEclose support caseDELETEidpathResolveMessage (Please also see note above.)
customerGET/get all support cases of a specific customerGET or blankcustomerIdpathListOfSupportCases (Please also see note above.)

For more information on REST parameters, e.g. input methods, see section REST Parameters further below.

...

Named methods are methods that refer to a HTTP method, but have a divergent name, e.g. resolve in the support case manager example.
To call such an method, append its name (or relativePath) to the parent resource.

ResourceREST MethodDescriptionTag httpMethodInputIn viaOutput (body)
supportcaseresolveset the status of the support case to resolvePUTidpathResolveMessage

Error Handling

Multiexcerpt
MultiExcerptNameError_Handling

Each REST port type should have a <<RESTError>> class assigned. The E2E Bridge will use this class as output in case of error (see Defining a REST Service Interface).

In the support manager example, REST port type SupportAPI has class RESTError assigned as error class.

Using function getRestHttpResponse(), you get access to the HTTP response object and can set the error details:

Code Block
local response = getRestHttpResponse();
set response.responseObject = <my error object>;
set response.httpStatus = <HTTP status code>;

Assign the error object and a HTTP status code that corresponds to the error. This information will be returned via the HTTP response.

Multiexcerpt include
MultiExcerptNameRESTErrorCodeAndMessage
PageWithExcerptDefining a REST Service Interface

In the support manager example, if user does not provide a support case id with the REST call, the implementation is as follows:

Error Handling for Specific Error Classes

If you defined a specific error class or Blob (Bridge 7.1.0) for a specific HTTP status code as described on Defining a REST Service Interface, you can use the same way as described above to provide the error details to the response. Provide the error details to an instance of the specific error class or Blob and provide the error class to the response object.
Look at activity Handle Authorization Errors of the support manager example:

...

The REST method can provide multiple output parameters via the response headers. These parameters can be of simple type or array of simple type.

Info

As of Runtime 2019.1,we changed how the Runtime handles header parameters that are not set. If you do not set a header parameter that is defined for an operation, this parameter is omitted and not provided in the response headers.
In older Runtime versions, such parameters were provided with NULL.

Example

Activity diagram Get All Support Cases of Customer shows the implementation of a header output parameter. It implements a GET request support cases of a specific customer. The support case data is provided via the response body as an array of complex type, the record count is provided via the response headers.

...