REST extension

Plugin ID

The plugin ID for REST API is fr.cantor.c4i.RESTDelivery.

Properties

Property keyDescriptionMandatoryDefault value
debugtrue to display debug logNofalse
destinationURLURL of the target REST API. See section "URL templating" for more infoYes
isKeyInURLtrue to send each object in a single request with the object ID in the URL, false otherwise. Use {id} in URL templateYes
batchSizeThe maximum number of elements to send in a single queryYes
configAssetIdThe ID of the asset containing the YAML mappingsYes
authenticationModeNONE, BASIC_AUTH, API_KEY_TOKEN, API_KEY_BEARER, X_API_KEY or OAUTH2_CLIENT_CREDENTIALSNoNONE
usernameThe username (Basic Auth) or Client ID (OAuth2)No
passwordThe password (Basic Auth), API Key or Client Secret (OAuth2) in standalone mode onlyNo
additionalHeader1Any additional header to send in the HTTP call. See section "Headers templating" for more infoNo
additionalHeader2Any additional header to send in the HTTP call. See section "Headers templating" for more infoNo
contentTypeContent-Type header value. Authorized values are APPLICATION_JSON (application/json) and TEXT_PLAIN (text/plain;charset=UTF-8)Yes
lastBatchHeaderIf 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 bodyNo
readTimeoutThe maximum time of inactivity between two data packets when waiting for the server's response in secondsNo
oAuth2TokenEndpointThe endpoint to retrieve the OAuth2 tokenNo
oAuth2ScopeThe OAuth2 token scopeNo
cacheConfigThe ID of the asset containing the JCS configurationNo

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 :

  1. Context ID using the variable {contextId}
  2. Destination name from YAML configuration file using the variable {destination}
  3. 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
Last Updated: