Pre-request script
Introduction
Pre-request scripts allow you to modify request parameters before sending the actual request. For example, you may wish to set dynamic values, add headers, or adjust the standard request body based on specific conditions.
Pre-request scripts cannot be used for endpoints configured with the body format
set to form
and sending data as files (i.e. defining a file as a key value).
Creating pre-request scripts
Pre-request
scripts are written and deployed in the usual way, via the custom scripts option.
Usage
When a pre-request
script is added to an endpoint, it is applied wherever that endpoint is used in process flows.
If your pre-request
script should only be applied to specific flows, we recommend creating a new iteration of the endpoint. For more information please see: Using a pre-request script for some process flows but not others.
Authentication variables
Pre-request
scripts can access authentication variables. For example, your system may require that a new signature (comprised of authentication variables) is generated for every request.
When a pre-request
script is present, all defined authentication variables are passed in automatically. These are ignored if not actively used in the pre-request
script.
Applying a pre-request script to an endpoint
Step 1
Select the pre-request script
tab for your endpoint:

Step 2
Click in the select a script
field and choose the script that you want to use - for example:

Step 3 Choose the script version that you want to use:

If your script is updated in future, remember to come back here and (if appropriate) select the later version.
Step 4
Review the script code to be applied, then click the save and go back
button:

Last updated