Workspaces and collections

Postino has no database. A workspace is a folder, a collection is a subfolder, and a request is a .postino file. Whatever you can do with files, you can do with your requests.

Anatomy of a workspace

shop-api/
shop-api/
├── environments/
│   ├── local.env
│   ├── staging.env
│   └── staging.local.env      # secrets, gitignored
├── auth/
│   └── login.postino
├── orders/
│   ├── create.postino
│   ├── list.postino
│   └── refunds/
│       └── create.postino
├── health.postino
└── .postino/
    └── runs/                  # load test history
        ├── 0001.json
        └── 0001.samples.csv.gz
Workspace
The folder you open. Its name is shown in the title bar and its path in the status bar.
Collection
Any folder inside the workspace. Folders can be nested as deep as you like.
Request
A .postino file. Its name in the sidebar is the file name without the extension. See the file format.
Environments
The top-level environments/ folder holds .env files instead of requests and is not shown in the collection tree. See Environments and variables.
.postino/
Postino's own data for this workspace. Today it only holds the load test run history in .postino/runs/, two files per run (see Files and folders).

What the sidebar shows

Postino scans the workspace folder and lists its .postino files and the folders that hold them, with these rules:

  • Hidden entries, whose name starts with a dot (.git, .postino, .vscode), are skipped at every level.
  • Folders named target or node_modules are skipped at every level, so build and dependency folders never flood the tree or slow down the scan.
  • A folder with no request anywhere inside it is not shown when it holds other files, so a workspace at the root of a code repository does not list src/ or docs/ as collections. An empty folder is shown, so a new collection can be filled. A folder that only holds hidden files, such as a .gitkeep, counts as empty.
  • A folder Postino is not allowed to read is skipped, with a warning in the log.
  • The top-level environments/ folder is skipped. A folder named environments deeper in the tree is a normal collection.
  • Files with another extension are ignored, so the workspace can live inside a code repository next to anything else.
  • Folders are listed before requests. Both are sorted in natural order: step2 comes before step10.
Tip

To control the order of requests, prefix their names with numbers: 01-login, 02-create-order, 03-pay. Natural sorting keeps 10- after 9-.

Creating a workspace

Click New workspace… in the welcome tab, or choose it in the workspace switcher in the title bar, or run it from the command palette. The dialog asks for:

Name
The name of the new folder, for example my-api. It is made safe for every operating system the same way as a request name (see Creating requests and folders).
Location
The folder the new one goes in. It starts as your Documents folder, or your home folder when there is none. Change… picks another one.

Below the fields, the dialog shows the full path it will create. Create (or Enter) creates it. A folder that already exists is only accepted when it is empty; otherwise the dialog says so and nothing is written.

Every new workspace starts with a small example, so the first Send works without editing anything:

my-api/
my-api/
├── .postino/
│   └── project.toml    # workspace configuration, see Files and folders
├── environments/
│   └── local.env       # baseUrl=https://postino.tanis.codes
├── hello.postino       # GET {{baseUrl}}/hello.json, with two tests
└── .gitignore          # *.local.env and .postino/runs/

Postino opens the new workspace, selects the local environment and opens hello.postino in a tab. It asks the Postino website for a small JSON file and checks the answer with two tests. Delete the example whenever you no longer need it.

Opening a workspace

  • From the app: click the workspace switcher in the title bar and choose one of the workspaces under Recent, or Open folder… below them. The welcome tab has Open folder… and the four most recent workspaces too. The command palette has Open folder…, and Ctrl O (⌘ O on macOS) opens the folder picker from anywhere.
  • At startup: Postino reopens the last workspace you used, as long as the folder still exists. When there is none to reopen, because it is the first start or every recent folder is gone, it opens the welcome tab instead. With Welcome tab at startup on in Settings, the welcome tab also opens next to the reopened workspace.
  • From a terminal: postino path/to/folder. See Command line.
  • By opening a request file: double click a .postino file, or pass it on the command line. Postino opens the remembered workspace if the file is inside it, otherwise the file's own folder, and then opens the file in a tab.

Postino reads the folder in the background: the sidebar shows Opening name… until it is ready, and the window keeps responding meanwhile. A folder with more than 20,000 files and folders, not counting the skipped ones, is not opened, since every change rescans the whole workspace and would become slow. That is usually a home folder or the root of a large repository: open the folder that holds your requests instead.

Postino remembers up to ten recent workspaces, and for each one the environment that was active, which is selected again when you reopen it. This memory lives in Postino's configuration folder, not in the workspace, so picking an environment never changes your git diff.

To take a workspace off the list, open the workspace switcher and click the X at the end of its row (Remove from history). It disappears right away; the folder and its files stay on disk untouched. The open workspace has no X: its row is marked with a check and Open.

Every folder in the sidebar starts collapsed when a workspace opens. Folders keep their open or closed state while you create, rename, move, delete or save, and the folders above a request are expanded automatically when you create it, move it or open it from outside the sidebar, for example from the command line. The open state is not remembered between sessions.

Creating requests and folders

Use the New request and New folder buttons in the sidebar header to create them at the root, or right click a folder to create them inside it. You can also run New request and New folder from the command palette.

A new request is written to disk right away as GET https://example.com, so it is a valid file from the start.

Names are made safe for every operating system: control characters and the characters Windows does not allow (< > : " / \ | ? *) become _, leading dots and trailing dots and spaces are removed, names are cut to 120 characters, and Windows device names such as CON or NUL are changed so the file can be created everywhere. If a file or folder with the same name already exists, Postino reports it and changes nothing.

Duplicating, renaming, moving and deleting

  • Duplicate from a request's context menu copies its file into the same folder as login copy.postino, or login copy 2.postino and so on when that name is taken, and opens the copy. The word copy follows the language of the app. The file is copied as it is on disk: unsaved changes in an open tab are not copied.
  • Rename from the context menu, or F2 with the entry selected in the sidebar, renames the file or folder on disk and updates any open tab. A request keeps its .postino extension.
  • Delete from the context menu, or Delete with the entry selected in the sidebar, asks for confirmation and then removes the file, or the folder and everything inside it. It does not use the trash: the file is gone. If the workspace is in git, you can still recover it from there.
  • Move a request or a folder to another folder by dragging it in the sidebar. While you drag, the folder it would go to is outlined and everything inside it is highlighted: the folder under the pointer, or the folder of the request under the pointer. Drop it on the empty space below the tree to move it to the root of the workspace. A folder moves with everything inside it, and can never be dropped into itself or into one of its own subfolders. The entry keeps its name and moves on disk, any open tab of a request it holds follows it, unsaved changes and the last response included, a moved folder keeps its subfolders expanded or collapsed, and the folder it lands in is expanded. If that folder already has a file or folder with the same name, Postino reports it and changes nothing.
  • Move several entries at once by selecting them with Ctrl + click (⌘ + click on macOS): the first one adds the entry that was already selected, and each click adds an entry or removes it again. Then drag any of them: they all move to the same folder, and the preview under the pointer shows how many. A request inside a selected folder moves with its folder. Dragging an entry that is not selected moves only that one, and a plain click goes back to selecting a single entry. If some of them cannot move because the folder already has an entry with that name, they stay where they are and Postino reports them, while the rest move.

Editing files outside Postino

Because requests are plain text, you can edit them in any editor, generate them with a script or merge them with git. A few things to keep in mind:

  • Postino does not watch the folder for changes. Reopen the workspace from the workspace switcher to see files created outside the app. Environment files are the exception: Postino reads them again when its window gets the focus back (see Environment files).
  • When you save a request, Postino writes it in its canonical form: the same content always gives the same bytes, with sections in a fixed order. Hand formatting such as extra blank lines between sections is normalized. See canonical serialization.
  • Files are saved atomically: Postino writes a temporary file and renames it over the old one, so a crash never leaves a half written request.

Sharing a workspace

There is nothing to export. Send the folder, put it on a shared drive or, best of all, commit it to git. See Working with git for a recommended layout and .gitignore.

The sample workspace

The source repository includes a workspace in samples/workspace with about 140 requests that exercise every feature: methods, parameters, every body type, authentication, scripts and tests, redirects, TLS and large responses. It comes with a small local server that answers all of them, so it works offline. From a checkout, make sample starts the server and opens the workspace. See Contributing.

Found a mistake? Edit this page on GitHub or open an issue.

↑↓to move ↵to open /or Ctrl Kto search from any page