Routes
Every HTTP path a Cardinal node answers, and which code answers it.
A node matches paths top to bottom. The host picks the site, and an unknown host is a 404. Every /api error uses the {"error": {...}} envelope.
API
| Path | Answered by | Details |
|---|---|---|
/health | Router | Auth and setup API |
/api/auth/* | Router | Login, logout, me, keys, passwords, sessions |
/api/setup/* | Router | state, regional-data, complete |
/api/website/language | Router | Language picker cookie |
/api/email/unsubscribe | Router | A mail's unsubscribe link |
/api/telegram/webhook | Router | Telegram bot updates |
/api/realtime/token, /api/realtime/websocket | Router, endpoint | Realtime |
/api/desk/boot | Router | The desk's start-up data, with an ETag |
/api/rec/*, /api/meta/* | CardinalWeb.Api | REST API |
/api/rpc/* | CardinalWeb.Api | RPC functions |
/api/file, /api/file/:name | CardinalWeb.Api | Upload and download |
/api/desk/meta/:rectype | CardinalWeb.Api | The desk meta bundle |
/api/desk/client-script/:rectype | CardinalWeb.Api | Enabled Client Scripts as one JavaScript module |
/api/desk/messages/:lang | CardinalWeb.Api | An enabled Language's translation dictionary |
/api/desk/user-settings/:rectype | CardinalWeb.Api | Saved list and report state, GET and POST |
/api/print/pdf, /api/print/report | CardinalWeb.Api | PDFs |
/api/blob/:app/*key | CardinalWeb.Api | Files an app stores in the bucket, for signed-in users |
/api/<app>/<route> | The app's api_routes module | Only on a site with the app installed |
Any other /api/* | Router | 404 |
Desk endpoints
| Method and path | Needs | Answers |
|---|---|---|
GET /api/desk/boot | A session, or a guest on an unclaimed site | User, roles, locale, settings, preferences, unread notifications, the RecType index, modules, workspaces, app plugins and versions, plus csrf_token. 304 when the ETag matches |
GET /api/desk/meta/:rectype?v=TAG | Read on the RecType | {meta, children}: layout, field UI, list config and indicators. Cached as immutable when v is the current x-cardinal-meta |
GET /api/desk/client-script/:rectype?v=TAG | Read on the RecType | A JavaScript module, cached the same way |
GET /api/desk/messages/:lang?v=TAG | A signed-in user, or a guest on an unclaimed site | One JSON object of catalog keys. 404 for a code that is not enabled |
GET, POST /api/desk/user-settings/:rectype | Read on the RecType | The saved state. POST merges top-level keys |
:rectype may be the RecType name or its desk slug, such as sales-invoice.
PDFs
| Path | Parameters | Needs |
|---|---|---|
GET /api/print/pdf | rectype, name, and optional format, settings, no_letterhead, letterhead, _lang | Read and print on the Record |
GET /api/print/report | name, filters (a JSON object), and the letter head and language parameters | The report and print rights |
Both render through Gotenberg and write an Access Log row. A sidecar that does not answer within 30 seconds is a 503.
curl -o inv.pdf -H "Authorization: token $KEY:$SECRET" \
'https://erp.acme.com/api/print/pdf?rectype=Sales%20Invoice&name=SINV-0001'Static files
| Path | Serves |
|---|---|
/desk, /desk/* | The desk's index.html. The desk's own router shows its 404 |
/assets/desk/* | The desk bundle, immutable |
/assets/web/* | The website bundle the auth pages load |
/assets/apps/* | Each app's desk plugin bundle |
/assets/<app>/assets/*, /assets/<app>/<mount>/assets/* | An app's own frontend files |
/<mount>/* | An app's own frontend, on a site with the app. A guest goes to /login |
Bundles go out as their .gz copies to clients that accept gzip.
Website
Every other GET or HEAD goes to the website router. Other methods get 405.
These routes are reserved for core's own pages, and an app cannot claim them:
| Route | Page |
|---|---|
/login | Login and forgot password |
/logout | Ends the session |
/update-password | Set a password from a link, or change it |
/accept-invite | Accept a User Invitation |
/me | The signed-in user's page |
/update-profile/<user> | The edit-profile Web Form |
/printview | A Record's print as HTML |
/robots.txt, /sitemap.xml | Crawlers |
The rest come from apps' www/ pages, Web Pages, Web Forms, redirects and route rules.