REST Adapter Reference
Stereotype Attributes
REST Alias
Attribute | Description | Allowed Values / Examples | |
---|---|---|---|
Name | Specify a name for the alias. | any string | |
Standard | |||
Protocol | Specify here the protocol through which the REST service is accessible. | http, https | |
Port | Specify here the port through which the REST service is accessible. | a valid port | |
Host | Specify here the host running the REST service. | a valid host | |
Base Path | Specify here the base path of the REST service. Please note that the base path differs whether you want to access a Designer service from the outside of PAS or from the inside. When you trigger Designer services within the platform, use the part of the path starting with /rest/.... | a valid path, e.g
| |
Ignore HTTP Errors | Specify here whether you want the REST adapter to throw an exception upon receiving an HTTP error code >= 400. | true | Do not throw an exception upon receiving an HTTP error code >= 400 (default). |
false | Throw an exception upon receiving an HTTP error code >= 400. | ||
Additional Request Headers | This attribute can contain a list of additional headers in form of name/value pairs. | Valid format is: <name>:<value>, e.g. API-Key:acme. Separate multiple headers with a comma. | |
Advanced | |||
HTTP Header Role Definitions for requests | In the context of HTTP based adapters (URL, REST), enable automatic header generation for the listed headers. These definitions overwrite the default behavior, and X-Transaction-Id, X-Request-Id, X-Sender-Host and/or X-Sender-Service will be substituted by this definition. requestHttpHeaderRoles can hold a list of definitions in format | client_host | Provide the client host in a header <http header name> |
client_service | Provide the client service in a header <http header name> instead of X-Sender-Service. | ||
correlation_id | Provide the correlation ID in a header | ||
transaction_id | Provide the transaction ID in a header <http header name> instead of X-Transaction-Id. | ||
passthrough | Pass a present header <http header name> to the called service. | ||
passthrough=<request header name> | Pass an present header <request header name> to the called service under the name of <http header name>. | ||
Digest Algorithm | Generates a HTTP digest header using the specified algorithm. When applied, a digest header is generated using the specified algorithm, and sent with the request. The generated header conforms with RFC3230 and RFC5843. Only one value is supported (no multi-value header). | None | No header generated (default). |
MD5 | Generate header using MD5 algorithm. | ||
SHA | Generate header using SHA algorithm. | ||
SHA-1 | Generate header using SHA-1 algorithm. | ||
SHA-256 | Generate header using SHA-256 algorithm. | ||
SHA-512 | Generate header using SHA-512 algorithm. | ||
Accepted Count of Redirects to Follow | Specify here the maximum number of redirects to follow. Default value is 0 (no redirects). | any integer, 0 (default) | |
cURL Options | Specify native cURL options as listed on Supported cURL Options. Use one of the following syntax rules:
| ||
JSON: Keep Null Values | When jsonKeepNulls is true, attributes of the REST response object having NULL values will be rendered to the REST response, otherwise they will be left out completely (see also chapter NULL Values). | true | Render attributes with NULL values to the REST call. |
false | Leave out attributes with NULL values in the REST call (default). | ||
JSON: Compact Format | When jsonCompact is true, the JSON composer will generate compact JSON, otherwise it will generate pretty JSON. | true | Generate compact JSON (default). |
false | Generate pretty JSON. | ||
JSON: Write Type Discriminator | If jsonCompact is true, the JSON composer will generate xUML type properties ("e2e:type") to the generated JSON. If this option is true, the Runtime will write the original xUML type to the generated JSON in form of | true | |
false | |||
Authentication | |||
User | Specify credentials here if the called REST service needs basic authentication. | Valid format is <user>/<password>, e.g. david.stringer/pAsWoRd456 | |
Proxy Settings (if the called REST service is accessed via a proxy) | |||
Proxy: URL | Specify the URL of the proxy server. | See CURLOPT_PROXY. | |
Proxy: User | Specify the proxy credentials. | See CURLOPT_PROXYUSERPWD, format is <user>/<password>, e.g. david.stringer/pAsWoRd456 | |
Proxy: Type | Specify the proxy type. | See CURLOPT_PROXYTYPE. | |
SSL Settings (if the called REST service uses SSL) | |||
SSL: CA Info | Specify a file name containing additional certificates for the connection verification (e.g. additional root CAs). | See CURLOPT_CAINFO. | |
SSL: Certificate File (sslCertificateFile) | Specify a fle name containing the client certificate. | See CURLOPT_SSLCERT. | |
SSL: Certificate Type | Specify the type of the certificate. | See CURLOPT_SSLCERTTYPE. | |
SSL: Private Key File | Specify a file name containing the private key. | See CURLOPT_SSLKEY. | |
SSL: Private Key Password | Specify the password for the private key. | See CURLOPT_KEYPASSWD. | |
SSL: Private Key Type | Specify the type of the key. | See CURLOPT_SSLKEYTYPE. | |
SSL: Verify Host | Specify whether to verify the host information form the SSL connection. | ||
SSL: Verify Peer | Specify whether to verify the peer information from the SSL connection. |
REST Adapter
Attribute | Description | Allowed Values / Examples | |
---|---|---|---|
Alias | Specify the REST alias the adapter should use to establish the connection. | a valid REST alias | |
Digest Algorithm | Generates a HTTP digest header using the specified algorithm. When applied, a digest header is generated using the specified algorithm, and sent with the request. The generated header conforms with RFC3230 and RFC5843. Only one value is supported (no multi-value header). | None | No header generated (default). |
MD5 | Generate header using MD5 algorithm. | ||
SHA | Generate header using SHA algorithm. | ||
SHA-1 | Generate header using SHA-1 algorithm. | ||
SHA-256 | Generate header using SHA-256 algorithm. | ||
SHA-512 | Generate header using SHA-512 algorithm. |
REST API
This stereotype defines a package as a REST port. It has no additional attributes.
REST Operation
Attribute | Description | Allowed Values / Examples | |
---|---|---|---|
Http Method | Provide the HTTP method of this REST method should respond to. | a valid HTTP method | GET, POST, PUT, DELETE, PATCH, HEAD, OPTIONS |
none |
| ||
Relative Path | Defines the path of the REST method in relation to the parent resource. | none | The name of the REST method will be used. |
any valid string | The given name will be used. The relative path may also contain variables (REST path parameters, specified as :<variable name>) and can be segmented like e.g. /date=:<a date variable>. | ||
Is Verbatim Path | Disable most of the path normalization. All escaping must be done manually, leading or trailing whitespaces are preserved.
| true | Path should be treated as verbatim, path normalization is disabled. |
false (default) | Path should be URL encoded. | ||
Blob Body Content Type | Specify the content type (as defined in RFC 7231) that the request will be sending. The Runtime generates a matching "Content-Type" header to your request. 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. | e.g. image/png | |
Reject Other Response Content Types | The xUML Runtime performs a verification of the content-type header for REST calls. Specify whether to return an error for requests with a content type that does not conform with the content types specified in Blob Body Content Type. | true |
|
false | Perform the adapter call in spite of "Content-Type" header mismatch, and let the service handle this. | ||
Accepted Request Content Types | Provide a list of content types you accept as a response. This must be a list of valid "accept" headers as defined in RFC 7231. The Runtime generates a matching "Accept" header to your request. 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. | a list of valid media ranges | e.g. image/jpeg;image/png |
Reject Other Request Content Types | Specify whether to return an error for responses with a content type that does not conform with the content types specified in Accepted Request Content Type. | true |
|
false | Perform the adapter call in spite of "Accept" header mismatch and let the service handle this. |
REST Parameter
Tagged Value | Description | Allowed Values | Allowed REST Methods | Allowed Types | Hints and Limitations | |
---|---|---|---|---|---|---|
In | Defines how the parameter will be passed to the REST method. This tag is mandatory. | query | via a query string | all | all simple types and Array of simple type | Unknown parameters will be ignored, known will be passed to the method after being URL-decoded. |
path | via the REST resource path | all | Integer, Float, String, Boolean, DateTime | Path parameters are all required. All path parameters must be consumed by the called method and the parameter names must be the same as the path segment identifiers (without colon). | ||
body | via the REST call body | POST, PUT, PATCH | a complex type and Array | A REST method can have only one body parameter. | ||
header | via the REST call header | all | all simple types and Array of simple type | Unknown parameters will be ignored, known will be passed to the method. | ||
External Name | Defines an external name for the REST parameter. | any string | Use this, when wanting to access a REST service that has parameter names with special characters. In this case, set this name (e.g. |
REST Error (Class)
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
create error;
set error = adapterResponse.responseObject;
if error is an object of the type indicated by this stereotype.
REST Port (Class)
Tagged Value | Description | Allowed Values | |
---|---|---|---|
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. |
any valid path string | path string starting with "/", e.g. | ||
errorClass | Assigns a user-defined RESTError 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)
Attribute | Description | Allowed Values | |
---|---|---|---|
Relative Path | Defines the path of the REST resource or collection in relation to the parent resource. You can provide a static path, or a dynamic path using the notation | none | the name of the REST resource will be used, e.g. /supportcases |
any valid string | the given name will be used | ||
a dynamic path supplying a REST parameter | dynamic path, the value of the REST parameter will be passed to the REST methods, e.g. :id | ||
Is Verbatim Path | Disable most of the path normalization. All escaping must be done manually, leading or trailing whitespaces are preserved.
| true | Path should be treated as verbatim, path normalization is disabled. |
false (default) | Path should be URL encoded. |
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
Name | Type | Direction | Description |
---|---|---|---|
requestOptions | in | Use this parameter to configure the REST Adapter dynamically and overwrite the settings from the component diagram. | |
response | Any | out | This parameter holds the adapter output and is of that type that is given back by the called REST service. |
REST 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. |
|
getRestHttpResponse() | none | object of type Response | Set the response details to return them to the caller. |
|
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
Attribute | Type | Description | Allowed Values / Examples |
---|---|---|---|
httpStatus | Integer | HTTP status code of the adapter call. | 500 |
headers | Array of HeaderField |
This attribute is deprecated. It is only present for compatibility reasons. Please use httpHeaderMap 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
| |
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. | |
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. |
Request
Attribute | Type | Description | Allowed Values / Examples |
---|---|---|---|
queryString | String | Query string, if provided with the call. |
|
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. |
|
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
Attribute | Type | Description | Allowed Values / Examples | |
---|---|---|---|---|
additionalHeaders | Array of HeaderField | All REST request header fields as an array of HeaderField classes containing name/value pairs. | ||
options | Array of Option | Specify native cURL options as listed in Setting cURL Options on the URL Adapter. Use one of the following syntax rules:
| ||
ssl | Use this parameter to supply SSL information. | |||
proxy | Use this parameter to supply necessary proxy information. | |||
additionalQueryParameters | Array of Parameter | Use this parameter to provide additional query parameters to the REST service call. | ||
followRedirects | Integer | Specify here the maximum number of redirects to follow. Default value is 0 (no redirects). | any integer | |
basicAuth | This parameter provides an object of type Authentication containing the user and the password. | |||
basePath | String | Overwrite here the base path of the REST service. | a valid path, e.g. /support | |
host | String | Overwrite here the host running the REST service that has been defined in the component diagram. | a valid host, e.g. scheer-acme.com | |
port | Integer | Overwrite here the port through which the REST service is accessible. | a valid port number, e.g. 12345 | |
protocol | String | Overwrite here the protocol through which the REST service is accessible. | http | Use the HTTP protocol to access the service (default). |
https | Use the HTTPS protocol to access the service. | |||
ignoreHttpErrors | Boolean | If true, Default value is true. | true | HTTP error codes >= 400 will not cause an exception in the service (default). This implies, that the response body is accessible even if HTTP errors occur. |
false | HTTP error codes >= 400 will cause an exception in the service. | |||
jsonComposerOptions | Use this parameter to specify JSON composer options on the REST call. You can use these options to e.g. overwrite jsonKeepNulls from the REST alias. | Valid composer options as described below. |
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. |
|
responseObject | Any | Response Object of the REST adapter call if the endpoint returns one (response output parameter). |
Request and Response Types
REST Type | Attribute | Type | Description | Allowed Values / Examples | |
---|---|---|---|---|---|
Authentication | username | String | Specify a username. | ||
password | String | Specify a password. | |||
Certificate | file | String | Provide name of a certificate file. | ||
type | String | Specify the type of the certificate file. | One of PEM or DER. | ||
ComposerOptions | jsonKeepNulls | Boolean | Specify the handling of | true | Keep |
false | Do not serialize | ||||
jsonCompact | Boolean | Specify the generated JSON format. | true | Serialize to JSON without pretty-printing. | |
false | Produce a pretty JSON. | ||||
jsonWriteTypeDiscriminator | Boolean | Specify whether to write type information to the generated JSON. | true | Write a type discriminator to the generated JSON. | |
false | Do not write a type discriminator to the generated JSON. | ||||
Entry | key | String | Specify the key of a map entry. | ||
value | Array of Any | Provide a list of values of the map entry. The dynamic type for httpHeaderMap is String. | |||
HeaderField | name | String | Specify the name of the header field. | ||
value | String | Provide a header value. | |||
Key
| file | String | Specify the name of the file that contains the private key. | ||
type | String | Specify the type of the private key. | |||
password | String | Specify the password for the private key. | |||
Option | name | String | Specify the name of the cURL option. | ||
value | String | Provide a value. | |||
Parameter | name | String | Specify the name of the parameter. | ||
value | String | Provide a value. | |||
Proxy | url | String | Specify a URL to the proxy server. | A valid URL. | |
type | String | Specify a proxy type | HTTP | The proxy is a HTTP proxy. | |
SOCKS5 | The proxy is a SOCKS5 proxy. | ||||
authentication | See above. | ||||
SSL | verifyPeer | String | Specify whether to verify the peer information from the SSL connection. | true | Verify the peer information (default). |
false | Do not verify the peer information. | ||||
verifyHost | String | Specify whether to verify the host information from the SSL connection. | On | Verify the host information (default). | |
Off | Do not verify the host information. | ||||
Existence | Only check for existence of the host. | ||||
caInfo | String | Specify the name of the file that contains additional certificates for the connection verification. | |||
certificate | Specify the certificate information (see above). | ||||
key | Specify the private key information (see above). |
RESTAdapter_SupportManager_Example
Click there to download a simple example model that shows the usage of the REST adapter in Scheer PAS Designer.
RESTAdapter_BlobContent_Example
Click here to download a simple example model that shows how to handle Blob content with a REST call in Scheer PAS Designer.
RESTAdapter_CallProcessWithRoles_Example
Click here to download a simple example model that shows how to call a subprocess from a parent process with a REST call in Scheer PAS Designer with special considerations of role handling.
Related Pages: