Articles in this section

Reference HTTP export and lookup response headers in transformations

You can access and reference export and lookup HTTP response headers with handlebar expressions when building transformations or transformation scripts. When using lookups to retrieve images and header data, you must use results mapping to map the header data before you can pass it on to the rest of your flow. While there are many practical applications, the most common use cases include:

  • Retrieving and passing response header data to the next step in your flow

  • Retrieving response headers when managing blob data

Important

To use a response header in other parts of your flow, complete the following two-step configuration:

  1. Transformation: Use a handlebar expression (for example, {{headers.content-type}}) and set an Output field name. This places the header value onto each record under that field name.

  2. Results mapping: Map the transformed field from data[*].<OutputFieldName> (Extract) to the destination field name you want downstream steps to see (Generate). The Extract field name must match the Output field name you set in the transformation; otherwise the header value will not appear in the payload.

Use the following steps to reference HTTP response headers with a handlebars expression:

  1. Click Settings (settings_gear.svg) for the transformation row.

    define_transform_settings.png
  2. Select Handlebars expression from the Field transformation type drop-down list.

    handlebars_field_type.png
  3. Click Handlebars (pencil_handlebars.svg) to open the Build handlebars expression AFE.

Response_headers_in_transformations.png

Use case: 3PL Central eTag retrieval

In this use case, you're retrieving a specific receipt, identified by its receiverID (also known as transactionID). When retrieving the receipt, 3PL Central provides an eTag value in the response header that you can use in further requests.

etag_header.png

For example, after retrieving the eTag value, you can use it in a PUT request to update an unconfirmed receiver. Where previously you'd need to use a workaround to retrieve the eTag, now you can retrieve and transform it directly through integrator.io using handlebars.

etag_put_.png
Step 1: Configure the transformation
  1. Open your transformation settings (⚙️) and add a rule with the following:

  2. Set Field transformation type to Handlebars expression.

  3. In the Handlebars expression, enter {{headers.eTag}}.

  4. In the Output field, enter eTag.

    The Output field name (eTag in this example) is the name under which the header value will be written onto each record in the data array. You'll reference this exact name in results mapping in Step 2.

Step 2: Configure results mapping
  1. Open HTTP results mapping for the lookup.

  2. Add a new mapping.

  3. In the Extract (source) field, enter data[*].eTag.

  4. In the Generate (destination) field, enter eTag or the field name expected by the downstream PUT request.

    The segment after data[*]. must match the Output field name from Step 1 exactly. The data[*] prefix is required because transformed fields are written into the data array.

Use case: Retrieve attachment headers for multi-part/form data

In this use case, you're using SAP Concur to retrieve expense report images.

The Content-Type response header identifies the file type for each record. To make this information available to downstream steps, add it to the record.

Step 1: Configure the transformation
  1. Open your transformation settings (⚙️).

  2. Add a new transformation rule.

  3. Set Field transformation type to Handlebars expression.

  4. In the Handlebars expression, enter {{headers.content-type}}.

  5. In the Output field, enter contentType.

The Output field name (contentType in this example) is the name under which the header value is written to each record in the data array. You'll reference this exact name in results mapping in Step 2.

headers_content_type_handlebars_afe.png
content_type_transform.png
Step 2: Configure results mapping
  1. Open HTTP results mapping for the lookup.

  2. Add a new mapping.

  3. In the Extract (source), enter data[*].contentType.

  4. In Generate (destination), enter FileType or any field name you want downstream steps to use.

The contentType segment must match the Output field name from Step 1 exactly. The data[*] prefix is required because transformed fields are written into the data array.

content_type_to_file_type.png
Step 3: Verify

You can force an error in the next step to inspect the raw payload and confirm that the FileType field is now present alongside the rest of the record, and that its value matches the original Content-Type response header.

Common mistakes
  • Omitting the data[*] prefix in the Extract field. Results mapping looks for transformed fields in the data array and will not find them at the root of the response.

  • Using the original header name (for example, Content-Type) as the Extract field. Use the Output field name defined in the transformation (for example, contentType) instead. Results mapping reads from the transformed record, not from the raw response headers.

  • Changing the Output field name without updating the Extract field. The field name used after data[*]. in the Extract field must exactly match the Output field name defined in the transformation.