The module in this package provides a REST client which is used to communicate with the REST server in other applications.
![]() |
|---|
The rest module description contains the following content:
- Client
- Client.js
- eventDispatcher.js
- RequestBuilder.js
- RequestHeader.js
Client.js
This module provides functionality to perform HTTP request to client application. It uses the AXIOS package as a REST client.
Function:
| Method and description | Input parameters | Return type |
|---|---|---|
| post This function performs HTTP POST method. |
{object} request object that consists of the httpRequestBody, httpRequestHeader, url. | {promise} return the response code. |
eventDispatcher.js
This module provides functionalities to trigger and dispatch the HTTP REST request from this application to other applications. This module associates with the requestBodyFactory to formulate the httpRequestBody in JSON format and interacts with the Axios REST client in the rest/client module to trigger the formulated HTTP request.
Functions:
| Method and description | Input parameters | Return type |
|---|---|---|
| dispatchEvent: This function formulates the HTTP request header and body and dispatches the event to the corresponding target REST server. |
{String} operationClientUuid uuid of the client operation that needs to be addressed. {String} httpRequestBody list of attributes that needs to be included in the request body based on the operation name. {String} user username of the request iniator. {String} xCorrelator UUID for the service execution flow that allows to correlate requests and responses. {String} traceIndicator sequence number of the request. {String} customerJourney holds information supporting the customers journey to which the execution applies. |
{Promise} true if the operation is successful. |
RequestBuilder.js
This module provides functionality to construct a REST request.
Function:
| Method and description | Input parameters | Return type |
|---|---|---|
| BuildAndTriggerRESTRequest This function triggers a REST request by calling the RESTClient |
{string} operationalClientUuid of service that needs to be addressed in the client application {string} method HTTP method for the REST request. {string} requestHeader HTTP request header for the REST call. {string} requestBody request body for the REST call. |
{Promise<Object>} returns the HTTP response received. |
RequestHeader.js
This class provides functionality to create a HTTP request header.
Field summary:
| Type | Field |
|---|---|
| String | user |
| String | originator |
| String | xCorrelator |
| String | traceIndicator |
| String | customerJourney |
| String | operationKey |
| String | contentType |
Constructor summary:
| Constuctor and description | parameters |
|---|---|
| This instantiates a new Request header instance. | {String} user identifier from the system starting the service call. If not available, originator value will be copied to this attribute. {String} xCorrelator UUID for the service execution flow that allows to correlate requests and responses. {String} traceIndicator Sequence of request numbers along the flow, if it is empty, set it to 1. {String} customerJourney Holds information supporting customer’s journey to which the execution applies. {String} operationKey operation key to access the service in the client application. |
Method Summary:
| Method and description | Input parameters | Return type |
|---|---|---|
| xCorrelatorGenerator This function generates a xCorrelator based on the regular expression provided in the specification. |
{promise} return the xCorrelator. |



