REST Adapter configuration
This page describes configuration for the Liberator REST Adapter.
Available from: Liberator 8.0.0
Requires: 17/21, Caplin StreamLink 8.0.0, Caplin Deployment Framework 8.0.0
Configuration file location
The REST Adapter kit packaged with Liberator includes two configuration files:
Configuration items
Configuration file: global_config/overrides/LiberatorRESTAdapter/etc/datasource.conf
.
add-rest-mapping
Publish a subject that proxies a REST endpoint.
add-rest-mapping accept-all-certificates boolean attribute-map string string auth-username string auth-password string base-url string http-header string string subject-prefix string end-rest-mapping
accept-all-certificates <boolean>
-
[Optional] This setting should be used to indicate that the REST Adapter should accept any certificate from the REST API service when an SSL connection is established.
Default value:
false
Example:
accept-all-certificates true
attribute-map substitution_token attribute_name
-
[Optional] A mapping from a substitution token used in the subject-prefix (
subject-prefix
) to an attribute which should be added to the JSON request payload. (See JSON Payload Manipulation.)Example:
attribute-map %1 currency_name
auth-username username
-
[Optional] "Basic" HTTP authentication scheme credential.
Example:
auth-username admin
auth-password password
-
[Optional] "Basic" HTTP authentication scheme credential.
Example:
auth-password password1234
base-url URL
-
The REST service base URL to map to a subject-prefix (
subject-prefix
).Example:
base-url https://api.open-meteo.com/v1/
http-header header_name header_value
-
[Optional] An HTTP header that the REST Adapter must include in every request to the REST service. Can be used multiple times to specify more than one header.
Example:
http-header X-Access-Token b1e6e452c26011edafa1
subject-prefix prefix
-
The subject prefix to map to a REST service base URL (
base-url
).Example:
subject-prefix /WEATHER/
The subject prefix can contain a numbered capture group as
%n
, wheren
is a number from 1 to 9. This makes it possible to include the captured token in the JSON request payload which is sent to the REST service. Seeattribute-map
.Example:
subject-prefix /WEATHER/%1
demo-rest-api-credentials
[Optional] Specifies credentials for the REST Adapter’s built-in demo REST service. By default, no credentials are specified and no one can access the demo REST service. Only one set of credentials can be specified.
Syntax: demo-rest-api-credentials username password
Requires: enable-demo-rest-api, rest-api-port
Default: none
Example: demo-rest-api-credentials user1 user1password
enable-demo-rest-api
[Optional] Enable the demo REST API in the REST Adapter. (See Enabling the demo REST API service in the REST Adapter.)
Syntax: enable-demo-rest-api boolean
Default: false
Requires: rest-api-port, demo-rest-api-credentials
Example: enable-demo-rest-api true
The demo REST API is provided for testing purposes only and should be disabled when using the REST Adapter in production. |
payload-max-size
This setting determines the maximum HTTP response payload size (in MB) that the REST Adapter is able to handle when mapping to a JSON response.
Syntax: payload-max-size integer
Default: 1
Valid values: 1 to 5 (MB)
Example: payload-max-size 2
rest-api-port
Specifies the port number of the adapter’s built-in REST server. Required for enable-demo-rest-api.
Syntax: rest-api-port <port>
Default: none
Example: rest-api-port 8099
SslKeyStorePath
Path to a TLS client-certificate KeyStore, containing a single certificate that identifies the REST Adapter in TLS mutual-authentication certificate exchanges.
This configuration is not set by default and is only required if one or more REST endpoints require TLS mutual-authentication. Follow instructions in the Java 11 keytool
documentation to create a PFX KeyStore and import a client-certificate signed by a trusted CA.
SslKeyStorePath absolute_path
SslKeyStorePath ${ENV:CONFIG_BASE}/overrides/LiberatorRESTAdapter/DataSource/etc/clientcert.pfx
SslKeyStorePassword
Password to the client-certificate KeyStore (SslKeyStorePath
).
SslKeyStorePassword password
SslKeyStorePassword changeit
SslTrustStorePath
Path to a CA certificate TrustStore, containing CA certificates trusted by the REST Adapter.
By default, the REST Adapter uses the default Java TrustStore.
SslTrustStorePath absolute_path
SslTrustStorePath ${ENV:JAVA_HOME}/lib/security/cacerts
SslTrustStorePassword
Password to the CA certificate TrustStore (SslTrustStorePath
).
SslTrustStorePassword password
SslTrustStorePassword changeit
See also: