API Platform
Scripts

Scripts

Introduction

The scripts feature allows you to write a javascript code to perform certain tasks before and after the request execution, also It allows you to write the test cases for various API requests.

Shared script (reusability)

The script can be written at multiple scopes (like request scope, folder scope and collection scope).

Request Scope

  • The script written at the request scope will be applicable for that specific request only.

Folder Scope

  • The script written at the folder scope will be applicable for all the child requests of that specific folder.
  • In a case where a piece of script is common for all requests within the folder then you can write that script at folder scope instead of writing for every request.

Collection Scope

  • The script written at the collection scope will be applicable for all the child requests of that specific collection
  • In a case where a piece of script is common for all requests within the collection then you can write that script at collection scope instead of writing for every request.

Examples

You can learn more

  1. How to write pre-request script in rest api?
  2. How to write test script in rest api?
  3. How to write shared pre-request script at collection scope?