Adding Dynamic Headers

Prev Next

The Adapter Team is often asked about adding specific headers to an API call made by an adapter. There are a few ways to do this, as explained in this article.

Static Headers

Headers that have static values should be added:

The Adapter Endpoint Configuration would be used if the headers are only used for a specific call while the Global Request property would be used if the header should be used on all adapter calls.

Dynamic Headers

When the value of a header is not known until the actual adapter call is made, it's considered "dynamic", and the static method above will not work. In this scenario, the header information must be provided with the actual adapter method being called.

In some cases, the adapter may already provide a parameter to take in the value. If so, you should provide the information in the task through this parameter. However, most of the time, this parameter will not exist. In such circumstances, if the adapter task has an iapMetadata object parameter, you can add the header information to this object.

Given this header ...

{
  "addlHeaders": {
    <header1_name>: <value1>,
    <header2_name>: <value2>
  }
}

An example would be:

{
  "addlHeaders": {
    "x_custom_header": "63121931219fdd",
    "Session-id": "AB9637462349"
  }
}

 

The iapMetadata object is one that you can build using the Platform workflow capabilities such as query, merge, etc.

If there is no iapMetadata object on the method (this will be true for older adapter methods), you can request that this object be added to the methods in the adapter. Be mindful, however, this will require that new methods be created so that Itential does not break the existing methods.