Skip to main content
Variable substitution is at the heart of how Xolo turns static request definitions into live, data-driven API calls. Every field in a request — URL, headers, query parameters, and body — is passed through VariableParser.parse() immediately before the HTTP request is sent. The parser resolves environment variables, path parameters, and a set of built-in dynamic helpers in a single pass, so you never need to manually update values between requests or environments.

Syntax Forms

VariableParser recognises three distinct variable syntax forms. All three are resolved by the same parse() method, so they can be mixed freely within a single string. When the parser encounters a token it cannot resolve — because the variable name does not exist in the current environment — it leaves the original placeholder untouched in the output rather than replacing it with an empty string. This makes missing variables immediately visible in resolved URLs and logs.

Static Environment Variables

Static variables are key-value pairs you define in an environment (e.g., Development, Staging, Production). At send time, Xolo reads the active environment and supplies its variables as the resolution map passed to VariableParser.parse().
You define these in Environments → New Variable and switch between environments without changing any request definition.

Built-in Dynamic Variables

Dynamic variables are prefixed with $ and are computed fresh on every call to parse() — they do not require any value to be defined in an environment. The following helpers are built into VariableParser: For the parameterised helpers, the arguments are encoded directly in the variable name:
Use {{$randomEmail}} in registration tests to avoid duplicate-email errors on repeated runs. Because a new random address is generated on every request, you can run the same “create account” flow as many times as you like without hitting a uniqueness constraint.

Recursive Resolution

VariableParser supports up to three levels of nested variable resolution. This means a variable value can itself contain {{...}} placeholders that will be resolved against the same variable map. For example, if your environment defines:
Then {{baseUrl}} resolves to https://api.example.com in a single parse() call. Xolo automatically detects when the resolved result still contains {{ markers and re-runs the parser (incrementing an internal depth counter), stopping when the output stabilises or depth reaches 3.

VariableParser.parse() and parseMap()

Both methods are static — no instance is needed.
parseMap() iterates over every entry: if a value is a String, both key and value are passed through parse(); non-string values (e.g., integers in query params) are kept as-is with only the key resolved.

Code Example

The following URL template demonstrates static environment variables alongside a dynamic helper:
Given the variable map:
VariableParser.parse() produces:
The {{$timestamp}} token does not need to appear in the variable map — it is computed by the parser itself on every call.