Managing Variables in Martini's HTTP Client
Overview
Variables in Martini's HTTP Client let you define reusable values and reference them across multiple HTTP requests using the [[variableName]] syntax.
Instead of hardcoding values like base URLs, ports, or tokens into every request individually, you define them once per folder and inject them wherever needed — making your requests easier to maintain and adapt across environments.
What You Will Learn
- How to open the Variables Editor for a request folder
- How to add, enable or disable, and delete variables
- How to reference variables in request URLs, headers, and bodies
- What happens when a variable has no value or is disabled
- How variable scope works across parent and child folders
- What built-in and mock variables are available
When To Use This
Use this when you need to:
- Share common values (like base URLs, ports, or tokens) across multiple HTTP requests.
- Simplify updates by changing a value in one place rather than editing each request individually.
- Manage environment-specific configurations (e.g., localhost vs. staging) efficiently.
Prerequisites
- Martini Designer installed and running
Managing HTTP Client Variables
Variables are set at the folder level in the HTTP Client. Each folder in Workspace Requests or User Requests can have its own set of variables, and requests inside that folder can reference them.
Opening the Variables Editor
To configure variables for a top-level folder (Workspace Requests or User Requests):
- Open the HTTP Client view.
- Hover over Workspace Requests or User Requests.
- Click the Configure Variables button that appears beside the folder.
Expected result: The Variables Editor opens for the selected folder.
To configure variables for a sub-folder inside Workspace Requests or User Requests:
- Right-click the sub-folder.
- Select Configure Variables from the context menu.
Expected result: The Variables Editor opens for the selected sub-folder.
Variables Editor Table
The Variables Editor displays variables in a table format, where each row represents a single variable. The columns in the table show the key details of each variable:
| Column | Description |
|---|---|
| Name | The unique identifier for the variable. Used in the [[variableName]] reference syntax. |
| Value | The value that replaces the [[variableName]] reference when the variable is active. |
| Description | An optional note describing the purpose of the variable. |
Adding Variables
To add a new variable:
- In the Variables Editor toolbar, click the Add button, or press + .
- A new row is added to the table.
- Fill in the Name, Value, and optionally the Description.
Expected result: The new variable appears in the table and is enabled by default.
Enabling and Disabling Variables
To disable a variable, uncheck the checkbox next to its name in the Name column. To re-enable it, check the checkbox again.
A disabled variable is not deleted — it remains in the table but its [[variableName]] references will not be substituted.
See How Variable Substitution Works for details on what happens when a variable is disabled.
Deleting Variables
Before deleting a variable, check whether any requests still reference it.
To find which requests use a variable:
- Click View in the menu bar, then select Search to open the Search view.
- In the search bar, type
[[variableName]](replacevariableNamewith the actual variable name). This is the exact syntax used in request files to reference a variable. - Click the Toggle Search Details button.
- In the files to include field, enter
*.request. - Review the results to see which HTTP request files use this variable.
If any requests reference the variable, update or remove those references before proceeding.
To delete a variable:
- Select one or more variable entries in the table.
- In the Variables Editor toolbar, click the Delete button, or press .
Expected result: The selected entries are removed from the table.
Referencing Variables in HTTP Requests
Requires Saved Request
User-defined variables can only be referenced in saved requests. See Saving and Deleting HTTP requests.
Once defined, variables can be referenced within an HTTP request using the [[variableName]] syntax.
When the request is executed, Martini substitutes each [[variableName]] with the corresponding variable's value.
Variables can be used in the following parts of a request configured in the HTTP Request Editor:
How Variable Substitution Works
When Martini executes a request, it replaces each [[variableName]] reference with the variable's resolved value.
| Condition | Result |
|---|---|
| Variable has a value and is enabled | [[variableName]] is replaced with the value |
| Variable has no value set | [[variableName]] is kept as a literal string |
| Variable is disabled | [[variableName]] is kept as a literal string |
| Variable is a built-in variable | [[variableName]] is replaced with the resolved runtime value |
| Variable is a mock variable | [[variableName]] is replaced with a randomly generated value |
Example:
If baseUrl is defined with a value of http://staging.example.com:
1 | |
If baseUrl has no value set, or is disabled:
1 | |
Variable Scope and Folder Inheritance
Variables in the HTTP Client use folder-scoped inheritance. Requests can only reference variables defined in their own folder or in any ancestor (parent) folder — not in sibling or child folders.
Inheritance rules:
- A request in
/FolderA/FolderBcan reference variables set in/FolderA/FolderB,/FolderA, or the root folder (Workspace RequestsorUser Requests). - A request in
/FolderAcannot reference variables set in/FolderA/FolderB(a child folder). - A request in
/FolderAcannot reference variables set in/FolderC(a sibling folder).
Precedence rules:
If a child folder defines a variable with the same name as a parent folder, the child folder's value takes precedence for requests within that child folder. This allows you to override inherited values for a specific sub-folder without affecting other folders.
Example folder structure:
1 2 3 4 5 | |
Built-in Variables
Martini includes a built-in variable, [[localhost]], which automatically resolves to the base URL of Martini Runtime in the current workspace.
| Variable | Resolved Value |
|---|---|
[[localhost]] |
http://localhost:<port> or https://localhost:<port>, where <port> is the configured port of Martini Runtime |
Key points about [[localhost]]:
- It is available in all requests, including unsaved ones.
- When Martini generates a request (for example, invoking a service or workflow from the HTTP Client), the generated URL uses
[[localhost]]automatically. - Use
[[localhost]]when building request URLs that target the local Martini Runtime.
Mock Variables
Mock variables generate a random value each time a request is executed. They are useful for testing requests with varied input data without manually editing values between executions.
Mock variables do not need to be defined in the Variables Editor — they are built into Martini and available in all requests, including unsaved ones.
Example:
A request body using mock variables:
1 2 3 4 5 | |
Each execution sends a different randomly generated name, email, and UUID.
Available Mock Variables
| Category | Available Variables |
|---|---|
| Data Type | datatype.boolean |
| Date | date.month, date.weekday, date.timeZone, date.anytime, date.past, date.future, date.between, date.betweens, date.recent, date.soon, date.birthdate |
| Location | location.zipCode, location.city, location.buildingNumber, location.street, location.streetAddress, location.secondaryAddress, location.county, location.country, location.continent, location.countryCode, location.state, location.direction, location.cardinalDirection, location.ordinalDirection, location.timeZone, location.language, location.latitude, location.longitude, location.nearbyGPSCoordinate |
| Number | number.int, number.float, number.binary, number.octal, number.hex, number.bigInt, number.romanNumeral |
| String | string.fromCharacters, string.alpha, string.alphanumeric, string.binary, string.octal, string.hexadecimal, string.numeric, string.sample, string.uuid, string.ulid, string.nanoid, string.symbol |
| Airline | airline.airport, airline.airline, airline.airplane, airline.recordLocator, airline.seat, airline.aircraftType, airline.flightNumber |
| Animal | animal.dog, animal.cat, animal.snake, animal.bear, animal.lion, animal.cetacean, animal.horse, animal.bird, animal.cow, animal.fish, animal.crocodilia, animal.insect, animal.rabbit, animal.rodent, animal.type, animal.petName |
| Book | book.author, book.format, book.genre, book.publisher, book.series, book.title |
| Color | color.human, color.space, color.cssSupportedFunction, color.cssSupportedSpace, color.rgb, color.cmyk, color.hsl, color.hwb, color.lab, color.lch, color.colorByCSSColorSpace |
| Commerce | commerce.department, commerce.productName, commerce.price, commerce.productAdjective, commerce.productMaterial, commerce.product, commerce.productDescription, commerce.isbn |
| Company | company.name, company.catchPhrase, company.buzzPhrase, company.catchPhraseAdjective, company.catchPhraseDescriptor, company.catchPhraseNoun, company.buzzAdjective, company.buzzVerb, company.buzzNoun |
| Database | database.column, database.type, database.collation, database.engine, database.mongodbObjectId |
| Finance | finance.accountNumber, finance.accountName, finance.routingNumber, finance.amount, finance.transactionType, finance.currency, finance.currencyCode, finance.currencyName, finance.currencySymbol, finance.currencyNumericCode, finance.bitcoinAddress, finance.litecoinAddress, finance.creditCardNumber, finance.creditCardCVV, finance.creditCardIssuer, finance.pin, finance.ethereumAddress, finance.iban, finance.bic, finance.transactionDescription |
| Food | food.adjective, food.description, food.dish, food.ethnicCategory, food.fruit, food.ingredient, food.meat, food.spice, food.vegetable |
| Git | git.branch, git.commitEntry, git.commitMessage, git.commitDate, git.commitSha |
| Hacker | hacker.abbreviation, hacker.adjective, hacker.noun, hacker.verb, hacker.ingverb, hacker.phrase |
| Image | image.avatar, image.avatarGitHub, image.personPortrait, image.url, image.urlLoremFlickr, image.urlPicsumPhotos, image.dataUri |
| Internet | internet.email, internet.exampleEmail, internet.username, internet.displayName, internet.protocol, internet.httpMethod, internet.httpStatusCode, internet.url, internet.domainName, internet.domainSuffix, internet.domainWord, internet.ip, internet.ipv4, internet.ipv6, internet.port, internet.userAgent, internet.mac, internet.password, internet.emoji, internet.jwtAlgorithm, internet.jwt |
| Lorem | lorem.word, lorem.words, lorem.sentence, lorem.slug, lorem.sentences, lorem.paragraph, lorem.paragraphs, lorem.text, lorem.lines |
| Music | music.album, music.artist, music.genre, music.songName |
| Person | person.firstName, person.lastName, person.middleName, person.fullName, person.gender, person.sex, person.sexType, person.bio, person.prefix, person.suffix, person.jobTitle, person.jobDescriptor, person.jobArea, person.jobType, person.zodiacSign |
| Phone | phone.number, phone.imei |
| Science | science.chemicalElement, science.unit |
| System | system.fileName, system.commonFileName, system.mimeType, system.commonFileType, system.commonFileExt, system.fileType, system.fileExt, system.directoryPath, system.filePath, system.semver, system.networkInterface, system.cron |
| Vehicle | vehicle.vehicle, vehicle.manufacturer, vehicle.model, vehicle.type, vehicle.fuel, vehicle.vin, vehicle.color, vehicle.vrm, vehicle.bicycle |
| Word | word.adjective, word.adverb, word.conjunction, word.interjection, word.noun, word.preposition, word.verb, word.sample, word.words |
Troubleshooting HTTP Client Variable Issues
| Problem | Detection | Cause | Fix |
|---|---|---|---|
Variable reference not substituted; literal [[variableName]] appears in request |
Outgoing request shows literal [[variableName]] |
Variable is disabled or has no value set | Enable the variable and set a value in the Variables Editor |
| Variable reference not substituted; variable is enabled and has a value | Request sends [[variableName]] literally |
Request file is in a folder that does not inherit from the folder where the variable is defined | Move the variable definition to a parent folder of the request, or redefine it in the request's own folder |
| Variable deleted but references remain in requests | Requests send literal [[variableName]] strings |
Variable was removed without updating request files | Use the Search view with the *.request filter and [[variableName]] query to locate and update affected requests |
Helpful Resources
- HTTP Client in Martini - Overview of the HTTP Client and all available features
- Creating Requests - How to create and save HTTP requests and organize them in folders
- HTTP Request Method and URL - Using variables in request URLs and query/path parameters
- HTTP Request Headers - Using variables in request headers
- HTTP Request Body - Using variables in the request body
- Community Q&A: Martini Community
Have a question? Post or search it here.