Apicat Docs
  1. Using scripts
Apicat Docs
  • What is Apicat?
  • Send requests
    • Create requests
      • Request basics
      • Parameters and body
      • Request headers
      • Request settings
      • Dynamic values
      • HTTP/2
      • SOAP/WebService
    • Authentication and authorization
      • Overview
      • CA and client certificates
      • Authorization types supported by Apidog
      • Digest Auth
      • OAuth 1.0
      • OAuth 2.0
      • Hawk Authentication
      • Kerberos
      • NTLM
      • Akamai EdgeGrid
    • Response and cookies
      • Overview
      • API response in Apidog
      • Create and send cookies
      • Debug requests
    • Dynamic values Modules
      • Airline
      • Animal
      • Color
      • Commerce
      • Company
      • Database
      • Datatype
      • Date
      • Finance
      • Food
      • Git
      • Hacker
      • Helpers
      • Image
      • Internet
      • Location
      • Lorem
      • Music
      • Number
      • Person
      • Phone
      • Science
      • String
      • System
      • Vehicle
      • Word
  • Environments & variables
    • Overview
    • Using variables
    • Environments & services
  • Pre/Post processors
    • Overview
    • Assertion
    • Extract variable
    • Wait
    • Database operations
      • Overview
      • MySQL
      • MongoDB
      • Redis
      • Oracle Client
    • Using scripts
      • Overview
      • Pre processor scripts
      • Post processor scripts
      • Public scripts
      • Postman scripts reference
      • Calling other programming languages
      • Using JS libraries
      • Visualizing responses
      • Script examples
        • Assertion scripts
        • Using variables in scripts
        • Using scripts to modify request messages
        • Other examples
  • Best practices
    • How to handle API signatures
    • How to access OAuth 2.0 protected APIs
    • Apidog collaboration workflow
    • Managing authentication state in Apidog
  • Account & preferences
    • Account settings
    • Generate OpenAPI access token
    • Language settings
    • Hot keys
    • Network proxy configuration
    • Data backup
    • Updating Apidog
    • Deleting account
    • Experimental Features
  • References
    • API-Design First Approach
    • Apidog OpenAPI/Swagger Specificaiton Extensions
    • JSONPath
    • XPath
    • Regular Expressions
    • JSON Schema
    • CSV File Format
    • Install Java Environment
    • Runner deployment environment
    • Apidog flavored Markdown
  1. Using scripts

Using JS libraries

Apidog supports the utilization of both built-in and non-built-in JavaScript class libraries within scripts.
1.
Built-In JS Class Libraries
You can use the built-in JS library in Apidog using require.
2.
Non-Built-In JS Class Libraries
You can introduce numerous other libraries that are not built-in but have been made available on npm dynamically using the $$.liveRequire function. Only pure js libraries are supported, preferably libraries with the word browser written to support browser-side operation. Libraries containing language extensions such as C/C++ are not supported for loading and will run out of time or exceptions.
TIP
You need to download JS libraries from the network for non-built-in libraries. Therefore, you must be connected to the Internet. There will be a performance loss to downloading libraries on the run. Therefore, we recommend using built-in JS libraries first.

Built-in Library List#

Encode and Decode
atob(v2.1.2): Base64 decode.
btoa(v1.2.1): Base64 encode.
crypto-js(v3.1.9-1): An Encoding / decoding library, including the common encoding and decoding methods (Base64, MD5, SHA, HMAC, AES, etc.).
You can only require the entire module, not a submodule of the class library. View the documentation here for more details.
jsrsasign(10.3.0): RSA encryption / decryption. Only Apidog version 1.4.5 or later is supported.
Assertion
chai (v4.2.0): BDD / TDD assertion library.
Tools
postman-collection(v3.4.0): Postman Collection library.
cheerio(v0.22.0): a subset of jQuery.
lodash (v4.17.11): JS Utilities Library.
moment(v2.22.2): Date libraries (not including locales).
uuid: generate UUID.
xml2js(v0.4.19): convert XML into JSON.
csv-parse/lib/sync( v1.2.4): parse CSV.
JSONSchema Validators
tv4(v1.3.0):JSONSchema validator.
ajv(v6.6.2):JSONSchema validator.
Built-in NodeJS modules
path
assert
buffer
util
url
punycode
querystring
string-decoder
stream
timers
events

Usage#

Assign a variable to the corresponding module before using it.
TIP
You can only require the entire module when using a built-in library; you cannot require a library submodule.
// A correct example.
var cryptoJs = require("crypto-js");
console.log(cryptoJs.SHA256("Message"));

// A wrong example.
var SHA256 = require("crypto-js/sha256");
console.log(SHA256("Message"));
Modified at 2025-06-25 07:57:16
Previous
Calling other programming languages
Next
Visualizing responses
Built with