Variables
Variables in JetClient can be defined at different levels: project, folder, and runtime.
- Runtime Variables: Defined in scripts and only available during script execution.
- Project and Folder Variables: Defined in the
Variablestab of the project or folder, using the JSON5 format.
The variables editor is divided into two sections: Shared and Local.
- Shared Variables are saved in the project/folder sync file and can be shared with your team.
- Local Variables are securely stored on your system and are not included in the sync file.
Project variables include environment-specific variables and globals, which are accessible regardless of the selected
environment. They are organized within a JSON object with the environment as a top-level property:
{
globals: {
baseUrl: 'https://api.example.com'
},
local: {
token: 'localToken'
},
dev: {
token: 'devToken'
}
}Folder variables can include both general variables and environment-specific variables. General variables are accessible regardless of the selected environment, while environment-specific variables are only available when the corresponding environment is selected:
{
myFolderVar: 'myValue',
dev: {
myFolderVar: 'devValue'
}
}Variables in JetClient can be primitive types, objects, and arrays, and are usable in scripts, requests, and folders. To utilize a variable in any field, enclose it in double curly braces: {{myVar}}. You can reference entire objects or arrays, for example in the body of a request, using {{myRequestBody}}.
Variables can also reference other variables, as shown in the example below:
{
array: [
{
myProperty: 123
}
],
// This variable resolves to string "123"
myVar: '{{array[0].myProperty}}',
// This variable resolves to number 123
myVar2: {{array[0].myProperty}}
}Variable Resolution Order
Variables are resolved in the following order, from highest to lowest priority:
- Runtime Variables
- Environment-specific Local Folder Variables
- Environment-specific Shared Folder Variables
- Local Folder Variables
- Shared Folder Variables
- Variables from All Parent Folders
- Environment Variables
- Globals