Ten small things that make the Requestarium CLI nicer to use
Most people learn requestarium run-collection and stop there. A few smaller options make day-to-day use much smoother.
1. Tab completion
requestarium completion bash >> ~/.bashrc
requestarium completion zsh > "${fpath[1]}/_requestarium"
requestarium completion fish > ~/.config/fish/completions/requestarium.fishOpen a new shell afterwards.
2. Names and paths, not ids
Every command takes a name or an id. Names are matched without regard to case, and a request can be named by its path:
requestarium run "auth/login" --env Staging
requestarium run "Admin/Users/List users" --collection "Users API"When a name matches more than one item, the command stops and lists the ids. requestarium collections prints the whole tree with ids in square brackets.
3. --quiet and --verbose
requestarium run-collection "Users API" --env Staging --quiet # only failures, then the summary
requestarium run-collection "Users API" --env Staging --verbose # headers, bodies, script console--quiet keeps CI logs readable for large collections. --verbose prints each request's method, URL, headers, the response status and headers, script console output, and (for collection runs) bodies cut at 4,000 characters. Secrets are masked in both.
4. Colours in CI
Colours are on in a terminal and off when output is piped or NO_COLOR is set. GitHub Actions shows ANSI colours, so set FORCE_COLOR=1 there. --no-color turns them off anywhere.
5. Write reports while reading the summary
--out, --junit and --html write files while the terminal shows the normal summary:
requestarium run-collection "Users API" --env Staging --out report.json --junit junit.xml --html report.html6. A session across commands
By default, cookies last one command. To log in once and keep the session:
requestarium run "Auth/Login" --env Staging --cookie-jar cookies.json
requestarium run "Account/Get profile" --env Staging --cookie-jar cookies.json
requestarium cookies --cookie-jar cookies.json # see what's stored, values maskedThe jar file holds session tokens and is written readable only by you. Keep it out of Git.
7. One-off variables
requestarium run "Get user" --env Staging --var userId=42
requestarium run "Get user" --env-file .env.local --env-var token=CI_TOKENLater sources win: --env-file, then --env-var, then --var.
8. Check your setup
requestarium statusIt prints the CLI version, the API URL, which token is in use (only its first characters), your workspaces, collection count and environments, and exits with 1 if something's wrong. Good as the first step of a CI job.
9. Code for a request
requestarium snippet "Get user" --lang python --env StagingTwelve languages, built the way run sends the request, with secrets shown as •••••• unless you add --show-secrets. See generating code from a request.
10. Stay up to date
requestarium updateprints whether a newer CLI is out and how to install it. The CLI also checks by itself at most once a day, only in an interactive terminal (never in CI or with --json). REQUESTARIUM_NO_UPDATE_CHECK=1 turns that off.