Predefined Functions

Getting Started
Installation
Setup
Inspect Traffic
HTTP Rules (Modify Traffic)
Session Book
Mock Server
API Client
File Server
Workspace
Public API
Guides
TroubleShooting
Subscription & Billing
Getting Started
Installation
Setup
Inspect Traffic
API Client
HTTP Rules (Modify Traffic)
Mock Server
File Server
Workspace
Public API
Guides
Session Book
Subscription & Billing
TroubleShooting
 

Predefined Functions

The following lists each built-in functions which Requestly supports and provides a short description of each one.
💡
Predefined functions are not usable with source conditions. They can only be used with output values.

rq_rand(num_digits)

Returns a random number with the given number of digits (num_digits) passed as the parameter. Max num_digits can be 8.
Supported Rule Types: Headers Rule, Redirect Rule, Replace Rule, QueryParam Rule
Eg: rq_rand(5) → 12345

rq_encode(val)

Returns the value encoded using encodeURIComponent
Supported Rule Types: Headers Rule, Redirect Rule, Replace Rule, QueryParam Rule
Eg: rq_encode(”user+test@example.com”)user%2Btest%40example.com

rq_decode(val)

Returns the value encoded using decodeURIComponent
Supported Rule Types: Headers Rule, Redirect Rule, Replace Rule, QueryParam Rule
Eg: rq_encode(”user%2Btest%40example.com”)user+test@example.com

rq_increment(num, step=1)

Returns the a number incremented by then step (Addition method)
Supported Rule Types: Headers Rule, Redirect Rule, Replace Rule, QueryParam Rule
Eg: rq_increment(3, 5) → 8

rq_decrement(num, step=1)

Returns the a number decremented by the step (Subtraction method)
Supported Rule Types: Headers Rule, Redirect Rule, Replace Rule, QueryParam Rule
Eg: rq_decrement(5, 3) → 2

rq_request_initiator_origin()

Returns the origin from where the current request is initiated.
Supported Rule Types: Headers Rule, Redirect Rule, Replace Rule, QueryParam Rule