4
Variables
Pavel Baksy edited this page 2026-05-18 17:39:51 +02:00
This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

Variables

Variables let you reuse values across requests and switch between environments (dev, staging, prod) with one click.

Syntax

Use {{variable_name}} in URL, headers, or body. When sending, Roster replaces placeholders with values from the selected environment.

GET {{base_url}}/users
Authorization: Bearer {{api_token}}

Managing Environments and Variables

Open via ⋯ → Manage Environments next to the project name in the sidebar.

Manage Environments dialog

  • Add environment: click + next to the environment list
  • Add variable: click + at the bottom of the variable list
  • Delete: click × on the variable row or environment header
  • Rename: click the name inline

Values are entered in the table cells per environment. Close the dialog to save.

Selecting an Environment

Use the environment dropdown at the top of the request panel. All {{...}} placeholders resolve to values from the selected environment.

Undefined variables are highlighted with a warning color; the literal {{variable_name}} is sent as-is.

Script Access

// Preprocessing
const url = roster.getVariable('base_url');

// Preprocessing or postprocessing
roster.setVariable('auth_token', data.access_token);
roster.setVariables({ token: data.token, user_id: data.id });

Sensitive Variables

For API keys and passwords, use Sensitive-Variables — values are stored in GNOME Keyring instead of plain-text JSON.

Storage

Regular variables: ~/.local/share/cz.bugsy.roster/requests.json (Flatpak: ~/.var/app/cz.bugsy.roster/data/cz.bugsy.roster/requests.json)