Automating API Using API collectionScripts in API Automation

Scripts in API Automation

Use pre-request scripts in algoQA API automation to dynamically set environment variables and generate random values before each API request is executed.

Run JavaScript pre-request scripts before each API call to dynamically update environment variables, generate random values, and prepare data for your API test scenarios.

Using Scripts in an API Project

Under the Scripts tab in the Request section, algoQA currently supports Pre-request scripts.

When you click Send, the pre-request script executes before the actual API request is called. This allows you to run JavaScript code — for example, using pm.environment.set() to assign a random value or dynamically update environment variables.

Once you click Send, the data is stored in the environment. You can view this data under the Env tab.

At present, dynamic environment data can be added through pre-request scripts.

Postman request Scripts tab with Pre-request script generating and saving a random number
Postman request Scripts tab with Pre-request script generating and saving a random number