Construct the Request
  • 05 Dec 2022
  • Dark
    Light
  • PDF

Construct the Request

  • Dark
    Light
  • PDF

Article Summary

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
};

Was this article helpful?

Changing your password will log you out immediately. Use the new password to log back in.
First name must have atleast 2 characters. Numbers and special characters are not allowed.
Last name must have atleast 1 characters. Numbers and special characters are not allowed.
Enter a valid email
Enter a valid password
Your profile has been successfully updated.