Construct the Request

Prev Next

Construct the Request Object

The third part of the API methods includes setting the request object.

The example below shows the detail that can go into the request object that is sent to Adapter Utils.

Example: Constructing the request object in adapter.js

/* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
..
// There will be lines here to modify the parameters you can hardcode information or take them in from parameters and format them accordingly.
..
// set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties,
// filter, priority and event
const reqObj= {
  payload: bodyToSendOnCall,                     // This is formatted based on the datatype
  uriPathVars: pathVariablesArray,               // This is an array of path variables
  uriQuery: queryParams,                         // This is a JSON object
  uriOptions: optionParams,                      // This is a JSON object
  addlHeaders: callSpecificAdditionalHeaders,    // This is a JSON object
  authData: dynamicAuthenticationBodyData,       // This is a JSON object
  callProperties: dynamicCallProps,              // This is a JSON object – match property structure
  filter: dynamicResponseFilter,                 // This is a JSONQuery string
  priority: #,                                   // This is a number that corresponds to value of a defined priority
  event: eventname                               // This is an event to trigger when data comes back
};