Page History
Versions Compared
Key
- This line was added.
- This line was removed.
- Formatting was changed.
Div | ||||||
---|---|---|---|---|---|---|
| ||||||
|
Stereotype Attributes
...
REST Alias
Multiexcerpt | |||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| |||||||||||||||||||||||||||||||
|
...
|
...
|
...
|
...
|
...
|
...
|
...
|
...
|
...
REST Adapter
Multiexcerpt | ||||||
---|---|---|---|---|---|---|
| ||||||
|
...
|
...
REST API
This stereotype defines a package as a REST
...
port. It has no additional attributes.
...
REST Operation
Multiexcerpt | |
---|---|
|
...
| ||||
|
...
|
...
|
...
|
...
|
...
|
...
|
RESTOperation
...
MultiExcerptName | REST |
---|
...
Provide the HTTP method of this REST method should respond to.
...
- method name, if it is one of: GET, POST, PUT, DELETE, PATCH, HEAD, OPTIONS (with optional trailing '/')
- GET otherwise
...
Multiexcerpt include | ||||||||
---|---|---|---|---|---|---|---|---|
|
...
|
...
|
...
|
...
|
...
|
...
|
...
|
...
|
...
|
...
|
...
|
...
|
...
RESTParameter
...
MultiExcerptName | RESTParameter |
---|
...
REST Adapter Parameters
|
...
Provide a list of content types this REST endpoint accepts. This must be a list of valid Accept headers as defined in RFC 7231.
Refer to Handling Blobs in the REST Interface for a deeper explanation and some examples.
Info |
---|
This attribute must be left unset if no Blob output parameters are used. In future versions, the effect of this attribute may be extended to other contexts as well. |
...
Specify whether to return an error on requests with a content type that does not conform with the content types specified in Accepted Request Content Type.
Refer to Handling Blobs in the REST Interface for a deeper explanation and some examples.
...
- Reject to perform adapter call if the header "accept" does not match the values
listed in Accepted Request Content Type (default).
- Exception:
Set "accept" header does not accept any of declared response content types
...
REST Parameter
Multiexcerpt include | ||||
---|---|---|---|---|
|
REST Error (Class)
Anchor | ||||
---|---|---|---|---|
|
The stereotype REST Error is used on a class to mark it as REST error class. Each REST port has a error class assigned that, in case of error, contains additional information. You can get this information using something like
Code Block |
---|
create error;
set error = adapterResponse.responseObject; |
if error is an object of the type indicated by this stereotype.
REST Port (Class)
Attribute | Description | Allowed Values / Examples | |
---|---|---|---|
path | Defines the path to this rest interface. If empty, the path is derived from the package structure. | none | path of the package structure will be used, e.g. /Services/SupportCase/SupportAPI |
any valid path string | path string starting with "/", e.g. /support | ||
errorClass | Assigns a user-defined REST Error class to the REST interface. This class should be set in case of error and given back via the REST response. | any complex type describing the structure of the error | |
apiVersion | Defines the API version this port type provides (for documentation purposes only). | any string, default is 1.0.0 |
REST Resource (Class)
Multiexcerpt include | ||||||
---|---|---|---|---|---|---|
|
REST Error Code (Property)
REST Error Code and REST Error Message are applied to one property of the REST Error class each to define that the corresponding properties contain the error code and the error message of the REST error. You cannot set REST Error Code on two properties of the same error class.
REST Error Message (Property)
REST Error Code and REST Error Message are applied to one property of the REST Error class each to define that the corresponding properties contain the error code and the error message of the REST error. You cannot set REST Error Message on two properties of the same error class.
REST Adapter Parameters
Multiexcerpt | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
| ||||||||||||
|
REST
...
With the REST Adapter, the xUML Runtime can handle JSON or XML as content types. The Runtime will parse either response content (JSON or XML) to a response object automatically.
You do not need to set any headers. If no headers are set, the Runtime will use JSON as a default format and set Accept header to application/json,text/json,application/xml;q=0.9,text/xml;q=0.9,*/*;q=0.8
.
Regarding response parsing, the xUML Runtime will process REST responses as follows:
- If the Content-Type header of the response is JSON or XML, respective format will be used (regardless what is specified in the Accept header).
- If the Content-Type header of the response is not set, the Runtime will assume that the content matches the Accept header of the request. If no Accept header has been specified, JSON is the fallback.
- In case of unsupported Content-Type, JSON is the fallback.
REST Parameter Types
Request
...
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.
Utility Functions
Access to HTTP request and response objects is provided through global methods: getRestHttpRequest()
and getRestHttpResponse()
.
Function | Parameter | Return Value | Description | Example |
---|---|---|---|---|
getRestHttpRequest() | none | object of type Request | Returns the request details as provided by the HTTP call. Changing the request object will not have any effects. For details see getRestHttpRequest(). | local request = getRestHttpRequest(); |
getRestHttpResponse() | none | object of type Response | Set the response details to return them to the caller. For details see getRestHttpResponse(). | local response = getRestHttpResponse(); |
REST Content Types
With the REST Adapter, the xUML Runtime can handle JSON or XML as content types. The Runtime will parse either response content (JSON or XML) to a response object automatically.
You do not need to set any headers. If no headers are set, the Runtime will use JSON as a default format and set Accept header to application/json,text/json,application/xml;q=0.9,text/xml;q=0.9,*/*;q=0.8
.
Regarding response parsing, the xUML Runtime will process REST responses as follows:
- If the Content-Type header of the response is JSON or XML, respective format will be used (regardless what is specified in the Accept header).
- If the Content-Type header of the response is not set, the Runtime will assume that the content matches the Accept header of the request. If no Accept header has been specified, JSON is the fallback.
- In case of unsupported Content-Type, JSON is the fallback.
REST Parameter Types
AdapterResponse
Multiexcerpt | |||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| |||||||||||||||||||||||||||||||
|
Request
Attribute | Type | Description | Allowed Values / Examples |
---|---|---|---|
queryString | String | Query string, if provided with the call. | status=in%20progress |
queryParameters | Array of Parameter | All query parameters as an array of Parameter classes containing name/value pairs. | |
body | Blob | Body of the HTTP request. | |
path | String | Path to the REST resource. | /support/supportcases/ |
pathParameters | Map | All REST parameters as a map. | |
httpHeaderMap | Map of Entry | Header information as a map. The map contains arrays of header value strings whereas the header name is the key of the map.
Refer to HTTP Header Support for more information on the standard xUML HTTP headers. |
RequestOptions
Multiexcerpt | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
...
|
Response
Attribute | Type | Description | Allowed Values / |
---|
...
Examples | ||
---|---|---|
headers | Array of HeaderField | All HTTP response header fields as an array of HeaderField classes containing name/value pairs. |
...
httpCode | Integer | The resulting HTTP status code. If not set explicitly using this object, the service returns 200 if no exception occurred, or 500 otherwise. | 404 |
...
responseObject | Any | Response Object of |
...
the REST adapter call if the endpoint returns one (response output parameter). |
Request and Response Types
Multiexcerpt | ||||
---|---|---|---|---|
| ||||
|
...
|
...
Specify native cURL options as listed in Setting cURL Options on the URL Adapter .
Use one of the following syntax rules:
- values separated by
','
in one line - values separated by
' '
in one line - list of tagged values
...
AdapterResponse
...
Response Object of the REST adapter call.
- If the adapter had an error, the responseObject is an <<RESTError>> class. It could be the default error class or a specific error class dependent on the <<RESTResponseDefinition>> dependencies and the HTTP status code.
- If the adapter call had no error, the responseObject is the same as the response output parameter.
...
- 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.
|
Panel | ||
---|---|---|
| ||
|
Multiexcerpt include | ||||||||
---|---|---|---|---|---|---|---|---|
|
Multiexcerpt include | ||||||
---|---|---|---|---|---|---|
|
Multiexcerpt include | ||||||
---|---|---|---|---|---|---|
|
Panel | ||
---|---|---|
| ||
Request and Response Types
...