Export a folder as a curl script for runbooks and bug reports

Sometimes the best format for a request is the oldest one: a curl command. An on-call runbook, a bug report for another team, a support engineer on a locked-down server, a vendor who asks "can you send me the exact request?". Requestarium can export a whole folder as curl commands, one per request.

Export a folder

Terminal
requestarium export "Orders API" --folder "Runbook" --format curl > runbook.sh

Each request in the folder becomes one curl command, with its method, URL, headers and body. In the app, Export as… on a folder offers the same format.

What a curl command can't hold, such as scripts and tests, is left out, with a warning: line on stderr for each.

Variables and secrets

Requests that use {{baseUrl}} and {{apiToken}} export with those placeholders. That's what you want in a file that will be pasted into a wiki or a ticket. Turn them into shell variables with one sed:

Terminal
sed -E 's/\{\{([A-Za-z0-9_]+)\}\}/${\1}/g' runbook.sh > runbook.env.sh

Then the reader sets them and runs:

Terminal
export baseUrl=https://api.example.com apiToken=…
sh runbook.env.sh

A literal token pasted into a request ends up in the export as is. Check the file before you share it, and move such values into secret variables in the collection.

A runbook folder

Make the folder worth exporting. For an on-call runbook:

Output
Runbook/
  Health check
  Get order (by id)
  Retry failed payment
  Rebuild search index
  Clear user sessions

Each request with a short doc line (shown in the app, and kept next to the export in your wiki): when to use it, what it changes, how to tell it worked.

The same folder runs from the CLI with tests and reports when you have Requestarium at hand:

Terminal
requestarium run "Orders API/Runbook/Health check" --env Production

and is a plain script when you don't.

One request

For a single request, you don't need an export:

  • In the app, the code snippet panel shows the request as curl, and in other languages (see generate code from a request).
  • In a terminal: requestarium snippet "Get order" --lang curl.

Other formats for other tools

--format http writes a .http file for VS Code REST Client and JetBrains HTTP Client, which keeps the requests editable in an IDE. --format postman, insomnia and bruno hand a folder to someone on another API client. See export to Postman, Insomnia or Bruno.