REST Configurations

The idea behind REST configurations is to create a collection of HTTP requests that can be used in the pfx-rest component. This collection also predefines some common features of the target system, e.g. authentication mechanism, request headers etc.

Definition

REST configurations are represented in the XML format and are part of the configuration as a whole. This is a sample REST configuration:

<rests> <connection> <connections> <connection>net.pricefx.integration.component.rest.domain.connection.OAuth2Connection</connection> </connections> <authRequestTemplate>{"grant_type": "client_credentials", "client_id": "::clientId", "client_secret": "::clientSecret", "scope": "::scope"} </authRequestTemplate> <headers> <header> <name>OData-MaxVersion</name> <value>4.0</value> </header> <header> <name>OData-Version</name> <value>4.0</value> </header> <header> <name>Prefer</name> <value>return=representation</value> </header> </headers> </connection> <rest> <name>getRecords</name> <uri>/api/data/{{apiVersion}}/{{recordType}}</uri> <method>GET</method> <properties> <property> <name>apiVersion</name> </property> <property> <name>recordType</name> </property> </properties> </rest> </rests>

Implementation Notes

  • connection part defines common connection fields for all configurations.

    • If authRequestTemplate is defined, such definition will be set to the connection and have precedence over the connection setup.

    • You can set up the elements headers and connections here instead of defining them for each configuration item.

  • rest defines a single configuration which can be referenced.

    • properties define customizations to the uri parameter where the placeholder {{}} exists.

    • method defines the HTTP request method.

    • You can also set up the elements headers and connections here for fine-graining.

  • If the headers or connections sections are defined both on the rests level and rest level, the result is merge of both definitions, where the rest level has precedence over rests regarding duplicate items.

IntegrationManager version 5.8.0