Intro to Scripts
Apidog contains a Javascript-based scripting engine. You can use scripts (JavaScript code snippets) to add dynamic behavior to API requests or collection tests.
Pre Processor Scripts
A preprocessor script is a code snippet that is executed before the request is sent. This is useful when you want to include a timestamp in the request header or send a random alphanumeric string in the URL parameters.
Post Processor Scripts
Postprocessor script is a code snippet that is executed after the request has been sent. It is mainly used to assert whether the result returned by the request is correct or not, write the result data returned by the request to environment variables, etc.
Public Scripts
Public scripts are designed to re-use scripts and avoid repetitions of the same scripts in different places.
Calling Other Programming Languages
1. Apidog version needs to be >= 1.0.25 to call external programs with scripts.
Using JS libraries
1. Built-In JS Class Libraries
pm Object API
Global Variables and Methods
Script Example
5 items