Views and Sharing
By the end of this chapter the same eight items wear three different faces — a grid, a board and a gallery — and one of those faces has been handed to the whole internet with a link, no account required. Nothing was copied: a view is a way of looking at a table, not a second table.
One table, several faces
Every table starts with a grid view: rows and columns, the spreadsheet face, with its own choice of which fields show, in what order, filtered and sorted how. The grid's arrangement belongs to the view, not the table — hiding a field in one view leaves it visible in another, and the records underneath never change.
The lab added two more views to Items,
and in doing so mapped this build's
API: the obvious route for creating a
view answers Cannot POST, because
each view kind has its own address
(transcript t08):
curl -X POST .../tables/<items-id>/kanbans \
-d '{"title":"By Category","fk_grp_col_id":"<category-id>"}'
curl -X POST .../tables/<items-id>/galleries \
-d '{"title":"Shelf Gallery"}'
- Kanban (
By Category) — records as cards, stacked in one column per value of a select field. Grouped by Category, the inventory becomes four stacks: Tools, Books, Games, Kitchen. Moving a card to another stack changes its category; the board is an editor, not a picture. - Gallery (
Shelf Gallery) — one card per record, built to lead with an attachment image where a table has one, which this lab's table does not.
The view kinds the documentation adds to those two, and this lab did not build: Form — fields as labelled boxes on a page, the data-entry face, and the kind you share when you want answers in rather than data out; Calendar and Timeline, which need a date field to stand on (Items has one — Acquired — so these are one dialog away); Gantt and Map round out the picker's list.
Sharing a view
A view can be shared: the server mints a long random UUID for it, and anyone holding the link can read that view — in the app, or through the public API — without an account, a token, or a cookie. The lab shared the Items grid and then made the proof as blunt as possible (transcript t08):
curl -X POST .../meta/views/<view-id>/share
# -> {"uuid":"d87d3a57-3b70-4857-...", ...}
curl http://localhost:18104/api/v2/public/shared-view/<uuid>/rows
# no headers at all -> all 8 rows, links resolved:
# {"Name":"Cordless drill", ..., "StoredIn":{"Id":1,"Name":"Garage Shelf"}}
Three properties to take seriously. First, the link is the key: nothing checks who follows it, so a shared view is exactly as public as wherever the link travels — a group chat is a publication. Second, sharing is per view: share a view filtered to one category, with the price field hidden, and the link shows only that. The view's arrangement is the access control. Third, sharing is revocable — turn it off and the UUID dies; the lab left its own link to die with the server, which it switched off at the end of the day.
The documentation adds two refinements this lab did not exercise: a shared view can be password-protected, and a shared form accepts submissions — the standard trick for an RSVP list or a fault-report inbox that feeds a table you keep private.