Work with adapter.js
adapter.js is the integration point between the adapter andItential Platform. It defines the methods available toItential Platform andItential Platform Automation Studio, formats request data for the adapter runtime libraries, and returns results toItential Platform. Each adapter should have a CALLS.md file listing its specific API calls.
Generic methods
These methods are available toItential Platform or to you as an adapter developer. Additional internal-only methods exist that are not listed here.
Constructor
The constructor instantiates the AdapterBase superclass. If you need to reference your own custom properties, capture them here. Custom properties must be defined in propertiesSchema.json.
Adapter broker methods
These methods integrate the adapter withItential Platform brokers.
Specific adapter methods
Each method that calls the external system follows the same four-part structure in adapter.js. The sections below describe each part and show an example.
Part 1: Parameters and logging
Define the method parameters and set the origin string used for trace logging and error handling. The number and type of parameters vary depending on what data the external system requires — a method can take zero or more parameters in addition to callback.
Part 2: Data validation
Validate required parameters before building the request. Use formatErrorObject to produce consistently formatted errors. The parameters to formatErrorObject are the error origin, a key from error.json (used as a display string if no matching key is found), an array of variables to populate the message, the error code from the external system, the raw response, and the stack trace or exception.
Part 3: Construct the request object
Build the reqObj that will be passed to the adapter libraries. Most fields are optional — include only what the specific call requires.
Part 4: Call to the adapter libraries
Pass the reqObj to identifyRequest. The entity must match the name of the entity directory, and action must match the name of the action in action.json. The returnDataFlag controls whether the adapter libraries return the full response payload (true) or just a success/fail result (false).
You can customize error handling and modify the returned data in the callback before passing it back toItential Platform. When possible, define translation in the schema and let the adapter libraries handle it rather than transforming data in the callback.