Setting REST Request Options
With the REST adapter, you can specify REST options on the REST alias (see Aliases). These options can be overridden dynamically on each REST call by providing an object of type RequestOptions to the REST adapter call like the following:
Create an object of type RequestOptions.
Set the attributes of this object according to your needs (e.g. in a mapping diagram).
Provide the object to the REST call.
A pin requestOptions is available as soon as you have applied the RESTAdapter stereotype.
Find below an example execution based on the RESTAdapter_SupportManager_Example.
Overview of the Request Options
You can set the following options:
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. |
Request 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). |
Related Pages: