REST extension
Plugin ID
The plugin ID for REST API is fr.cantor.c4i.RESTDelivery
.
Properties
Property key | Description | Mandatory | Default value |
---|---|---|---|
debug | true to display debug log | No | false |
destinationURL | URL of the target REST API. See section "URL templating" for more info | Yes | |
isKeyInURL | true to send each object in a single request with the object ID in the URL, false otherwise. Use {id} in URL template | Yes | |
batchSize | The maximum number of elements to send in a single query | Yes | |
configAssetId | The ID of the asset containing the YAML mappings | Yes | |
authenticationMode | NONE , BASIC_AUTH , API_KEY_TOKEN , API_KEY_BEARER , X_API_KEY or OAUTH2_CLIENT_CREDENTIALS | No | NONE |
username | The username (Basic Auth) or Client ID (OAuth2) | No | |
password | The password (Basic Auth), API Key or Client Secret (OAuth2) in standalone mode only | No | |
additionalHeader1 | Any additional header to send in the HTTP call. See section "Headers templating" for more info | No | |
additionalHeader2 | Any additional header to send in the HTTP call. See section "Headers templating" for more info | No | |
contentType | Content-Type header value. Authorized values are APPLICATION_JSON (application/json) and TEXT_PLAIN (text/plain;charset=UTF-8) | Yes | |
lastBatchHeader | If a value is provided, then the last batch for an object type will have this value as a header. It may produce an additional REST call with an empty body | No | |
readTimeout | The maximum time of inactivity between two data packets when waiting for the server's response in seconds | No | |
oAuth2TokenEndpoint | The endpoint to retrieve the OAuth2 token | No | |
oAuth2Scope | The OAuth2 token scope | No | |
cacheConfig | The ID of the asset containing the JCS configuration | No |
Notes
All HTTP queries are performed using the POST method.
Configuration example
extensions.[0].pluginId=fr.cantor.c4i.RESTDelivery
extensions.[0].destinationURL=http://my-web-server.com
extensions.[0].isKeyInURL=true
extensions.[0].batchSize=100
extensions.[0].username=c4i
extensions.[0].configAssetId=C4I-Configuration
extensions.[0].authenticationMethod=OAUTH2_CLIENT_CREDENTIALS
extensions.[0].oAuth2TokenEndpoint=https://my-oauth2-endpoint.com/auth/realms/myrealm/protocol/openid-connect/token
extensions.[0].additionalHeader1=Execution-Id: {uuid}
extensions.[0].additionalHeader2=MyHeader: Value
extensions.[0].contentType=APPLICATION_JSON
extensions.[0].lastBatchHeader=Last-Batch= true
extensions.[0].readTimeout= 10
extensions.[0].oAuth2Scope=my-custom-scope
pluginId=fr.cantor.c4i.RESTDelivery
destinationURL=http://my-web-server.com
isKeyInURL=true
batchSize=100
username=c4i
password=client_secret
configAssetId=/Path/to/C4I/Configuration.yml
authenticationMethod=OAUTH2_CLIENT_CREDENTIALS
oAuth2TokenEndpoint=https://my-oauth2-endpoint.com/auth/realms/myrealm/protocol/openid-connect/token
additionalHeader1=Execution-Id: {uuid}
additionalHeader2=MyHeader: Value
contentType=APPLICATION_JSON
lastBatchHeader=Last-Batch= true
readTimeout= 10
licenseAssetId=/Path/to/C4I/License.cat
cacheConfig=/Path/to/JCS/Config.ccf
oAuth2Scope=my-custom-scope
URL templating
The target URL can be templated with :
- Context ID using the variable
{contextId}
- Destination name from YAML configuration file using the variable
{destination}
- Object ID using the variable
{id}
For instance, given the following URL tempate : http://my-web-server.com/{destination}?lang={contextId}
,
And using the following YAML configuration file :
- Product:
products[id]:
...
- Entity:
entities[id]:
...
While parsing a file in the context fr_FR
,
Products will be sent to the following URL : http://my-web-server.com/products?lang=fr_FR
.
Entities will be sent to the following URL : http://my-web-server.com/entities?lang=fr_FR
.
Using the following URL template : http://my-web-server.com/{destination}/{id}?lang={contextId}
,
The product with ID PRD0001
will be sent to the following URL : http://my-web-server.com/products/PRD0001?lang=fr_FR
.
Header templating
The headers can be templated with the following values :
{uuid}
: Will generate a unique ID to link all the batches of the same execution