Date and Time Helpers
now
Renders the current date/time with optional formatting and offset. Parameters:format: Date format string (optional, defaults to ISO8601)offset: Time offset (e.g., ‘3 days’, ‘-24 seconds’)timezone: Timezone (optional, defaults to UTC)
date
Manipulates existing date values with offset, timezone, and format changes. Parameters:- First parameter: Date value
format: Date format string (optional)offset: Time offset (optional)timezone: Timezone (optional)
parseDate
Parses date strings into date objects. Parameters:- First parameter: Date string
format: Parser format string (optional)
dateFormat
Formats date values to strings using predefined or custom formats. Parameters:- First parameter: Date value
- Second parameter: Format name (
full,long,medium,short) or custom format string format: Alternative way to specify format string
truncateDate
Truncates date/times to specific points. Parameters:- First parameter: Date value
- Second parameter: Truncation point
first minute of hourfirst hour of dayfirst day of monthfirst day of next monthlast day of monthfirst day of yearfirst day of next yearlast day of year
String Helpers
regexExtract
Extracts values from strings using regular expressions. Parameters:- First parameter: Input string
- Second parameter: Regular expression pattern
- Third parameter (optional): Variable name to assign captured groups
trim
Removes whitespace from the start and end of strings. Usage:abbreviate
Truncates strings that exceed a specified length, adding ellipsis. Parameters:- First parameter: Input string
- Second parameter: Maximum length
Mocking APIs helps...
See String Helpers for more details.
capitalize
Capitalizes the first letter of each word. Parameters:- First parameter: Input string
Mock My Stuff
See String Helpers for more details.
capitalizeFirst
Capitalizes only the first character of the string. Parameters:- First parameter: Input string
Mock my stuff
See String Helpers for more details.
center
Centers text in a field of given width. Parameters:- First parameter: Input string
size: Field width (required)pad: Padding character (optional, defaults to space)
cut
Removes all instances of a specified substring. Parameters:- First parameter: Input string
- Second parameter: Substring to remove
mocking stubbing faults
See String Helpers for more details.
defaultIfEmpty
Returns the input value if not empty, otherwise returns a default. Parameters:- First parameter: Input value
- Second parameter: Default value
join
Joins multiple values or collections into a single string. Parameters:- Multiple values to join
- Last parameter: Separator string
prefix: Optional prefixsuffix: Optional suffix
ljust
Left-aligns text in a field of given width. Parameters:- First parameter: Input string
size: Field width (required)pad: Padding character (optional)
rjust
Right-aligns text in a field of given width. Parameters:- First parameter: Input string
size: Field width (required)pad: Padding character (optional)
lower
Converts string to lowercase. Parameters:- First parameter: Input string
wiremock cloud
See String Helpers for more details.
upper
Converts string to uppercase. Parameters:- First parameter: Input string
WIREMOCK CLOUD
See String Helpers for more details.
replace
Replaces all occurrences of a substring with another. Parameters:- First parameter: Input string
- Second parameter: Substring to find
- Third parameter: Replacement string
the right way
See String Helpers for more details.
slugify
Converts text to URL-friendly slug format. Parameters:- First parameter: Input string
mock-my-apis
See String Helpers for more details.
stripTags
Removes all HTML/XML tags from string. Parameters:- First parameter: Input string
hi
See String Helpers for more details.
substring
Extracts a portion of a string between indices. Parameters:- First parameter: Input string
- Second parameter: Start index
- Third parameter (optional): End index
wordWrap
Wraps text at specified line length. Parameters:- First parameter: Input string
- Second parameter: Line length
yesno
Maps boolean/null values to customizable yes/no/maybe strings. Parameters:- First parameter: Boolean or null value
yes: Custom yes string (optional)no: Custom no string (optional)maybe: Custom maybe/null string (optional)
Encoding Helpers
base64
Encodes or decodes Base64 strings. Parameters:- First parameter: Input string
decode: Set totruefor decoding (optional)padding: Set tofalseto disable padding (optional)
urlEncode
Encodes or decodes URL strings according to HTTP URL encoding standard. Parameters:- First parameter: Input string
decode: Set totruefor decoding (optional)
formData
Parses HTTP form data into an object. Parameters:- First parameter: Form data string
- Second parameter: Variable name to assign
urlDecode: Set totrueto URL decode values (optional)
Number Helpers
math
Performs arithmetic operations. Parameters:- First parameter: Left operand
- Second parameter: Operator (
+,-,*,/,%) - Third parameter: Right operand
+: Addition-: Subtraction*: Multiplication/: Division%: Modulo (remainder)
numberFormat
Formats numbers with control over style, decimal places, and locale. Parameters:- First parameter: Number to format
- Second parameter (optional): Format type (
integer,currency,percent) or format string - Third parameter (optional): Locale string
maximumFractionDigits: Maximum decimal placesminimumFractionDigits: Minimum decimal placesmaximumIntegerDigits: Maximum integer digitsminimumIntegerDigits: Minimum integer digitsgroupingUsed: Enable/disable digit grouping (default true)roundingMode: Rounding mode (up,down,half_up,half_down,half_even,ceiling,floor)
Random Value Helpers
randomValue
Generates random strings of specified type and length. Parameters:length: Length of string (required for most types)type: Type of random string (required)uppercase: Convert to uppercase (optional)
ALPHANUMERIC: Letters and numbersALPHABETIC: Letters onlyNUMERIC: Numbers onlyALPHANUMERIC_AND_SYMBOLS: Letters, numbers, and symbolsHEXADECIMAL: Hex characters (0-9, A-F)UUID: UUID format (length not needed)
randomInt
Generates random integers with optional bounds. Parameters:lower: Lower bound (optional)upper: Upper bound (optional)
randomDecimal
Generates random decimal numbers with optional bounds. Parameters:lower: Lower bound (optional)upper: Upper bound (optional)
pickRandom
Randomly selects a value from parameters or collection. Parameters:- First parameter: Collection (optional) or first value
- Additional parameters: More values to choose from
count: Number of unique items to select (optional)
random
Generates random test data using Faker library. Parameters:- First parameter: Faker key (e.g., ‘Name.firstName’, ‘Address.city’)
JSON Helpers
jsonPath
Extracts values from JSON documents using JSONPath expressions. Parameters:- First parameter: JSON string or object
- Second parameter: JSONPath expression
jsonArrayAdd
Appends elements to a JSON array. Parameters:- First parameter: Existing array
- Second parameter (optional): Item to add
maxItems: Maximum array size (optional)flatten: Flatten nested arrays (optional)jsonPath: Path to nested array (optional)
jsonRemove
Removes elements from JSON arrays or keys from objects using JSONPath. Parameters:- First parameter: JSON object or array
- Second parameter: JSONPath expression
jsonMerge
Merges two JSON objects recursively. Parameters:- First parameter: Base object
- Second parameter (optional): Object to merge
removeNulls: Remove null-valued attributes (optional)
formatJson
Formats JSON in pretty or compact style. Parameters:- First parameter (optional): JSON to format
format: Style (prettyorcompact, defaults topretty)
parseJson
Parses JSON string into object and assigns to variable. Parameters:- First parameter: JSON string or variable name
- Second parameter (optional): Variable name to assign
toJson
Converts any object to JSON string. Parameters:- First parameter: Object to convert
XML Helpers
xPath
Extracts values or sub-documents from XML using XPath 1.0 expressions. Parameters:- First parameter: XML string
- Second parameter: XPath expression
soapXPath
Convenience helper for extracting values from SOAP body elements. Parameters:- First parameter: SOAP XML string
- Second parameter: XPath expression (relative to SOAP body)
formatXml
Formats XML in pretty or compact style. Parameters:- First parameter (optional): XML to format
format: Style (prettyorcompact, defaults topretty)
Cryptographic Helpers
hash
Creates cryptographic hashes of text. Parameters:algorithm: Hashing algorithm (required)encoding: Output encoding (hexorbase64, required)
sha-1,sha-224,sha-256,sha-384,sha-512sha3-224,sha3-256,sha3-384,sha3-512md2,md5
JWT Helpers
jwt
Generates signed JSON Web Tokens. Parameters:alg: Signing algorithm (HS256orRS256, defaults toHS256)maxAge: Expiry duration (e.g., ‘12 days’)exp: Expiry date (alternative to maxAge)nbf: Not before date (optional)iss: Issuer claim (optional)aud: Audience claim (optional)sub: Subject claim (optional)- Any additional parameters become custom claims
jwks
Generates JSON Web Key Set for RS256 public keys. Usage:Dynamic State Helpers
state
Retrieves a state value stored in a context by its key. Parameters:- First parameter: Key name (required)
context: Context name (optional, uses default context if not specified)
stateContext
Sets the default context for allstate helpers within its block, avoiding repetition.
Parameters:
- First parameter: Context name or expression (required)
listState
Returns all state values within a given context as a collection. Parameters:- First parameter: Context name or expression (required)
Collection and Utility Helpers
assign
Creates a string variable for later use. Parameters:- First parameter: Variable name
val
Accesses values with default fallback, maintains type (unlike assign). Parameters:- First parameter: Value or expression
or/default: Default value if first parameter is absentassign: Variable name to assign result
size
Returns the size of a string, list, or map. Parameters:- First parameter: String, list, or map
with
Creates a nested scope for accessing object properties. Parameters:- First parameter: Object
range
Generates an array of integers between two bounds. Parameters:- First parameter: Lower bound (inclusive)
- Second parameter: Upper bound (exclusive)
array
Creates an array containing the specified values. Parameters:- Any number of values
arrayAdd
Adds an element to an array at specified position. Parameters:- First parameter: Array
- Second parameter: Element to add
position: Index,start, orend(optional, defaults to end)
arrayRemove
Removes an element from an array at specified position. Parameters:- First parameter: Array
position: Index,start, orend(optional, defaults to end)
arrayJoin
Concatenates array values with a separator. Parameters:- First parameter: Separator string
- Additional parameters: Values or array to join
prefix: String to prepend (optional)suffix: String to append (optional)
hostname
Returns the hostname of the mock API. Usage:Conditional Logic Helpers
if
Evaluates condition and renders block if true. Usage:unless
Evaluates condition and renders block if false. Usage:eq
Tests equality. Parameters:- First parameter: Left value
- Second parameter: Right value
neq
Tests inequality. Parameters:- First parameter: Left value
- Second parameter: Right value
gt
Tests greater than. Parameters:- First parameter: Left value
- Second parameter: Right value
gte
Tests greater than or equal to. Parameters:- First parameter: Left value
- Second parameter: Right value
lt
Tests less than. Parameters:- First parameter: Left value
- Second parameter: Right value
lte
Tests less than or equal to. Parameters:- First parameter: Left value
- Second parameter: Right value
and
Logical AND operation. Parameters:- Multiple boolean expressions
or
Logical OR operation. Parameters:- Multiple boolean expressions
not
Logical NOT operation. Parameters:- One boolean expression
contains
Tests if string or array contains a value. Parameters:- First parameter: String or array
- Second parameter: Value to find
matches
Tests if string matches a regular expression. Parameters:- First parameter: String to test
- Second parameter: Regular expression pattern
Iteration Helpers
each
Iterates over collections (arrays or objects). Usage:@index: Current iteration index (zero-based)@first: True if first iteration@last: True if last iteration