Chuyển tới nội dung chính

HTTP conventions

Generated routes follow one grammar, so clients can call any domain without per-domain code. All paths sit under api_base (default /api).

Route grammar​

KindMethodPath
Collection commandPOST/{api_base}/{ns}/{cmdkey}:post/{resource}
Collection command, scopedPOST/{api_base}/{ns}/{cmdkey}:post/{scope}/{resource}
Object commandPOST/{api_base}/{ns}/{cmdkey}:exec/{resource}/{id}
Object command, scopedPOST/{api_base}/{ns}/{cmdkey}:exec/{scope}/{resource}/{id}
Signed linkGET/{api_base}/{ns}/{cmdkey}:link/{link_token}
Signed hookGET/{api_base}/{ns}/{cmdkey}:hook/{hook_token}
Command metadataGET/{api_base}/{ns}/{cmdkey}.meta
Domain discoveryGET/{api_base}/{ns}/domain.meta
ListGET/{api_base}/{ns}/{resource}.list (scoped: .list/{scope})
ItemGET/{api_base}/{ns}/{resource}.item/{id} (scoped: .item/{scope}/{id})
Resource metadataGET/{api_base}/{ns}/{resource}.meta
ReportPOST/{api_base}/{ns}/{report}.rept (scoped: .rept/{scope})
OpenAPIGET/{api_base}/openapi.json

Naming rules: namespaces are dotted (riverbase.todo), command keys are verb-noun with dashes (create-todo), and resources are lowercase (todo, todo_summary). The method marker is joined to the last segment (todo.list, create-todo:post), not a separate path segment.

Request bodies​

Commands and reports take a JSON body with a single payload key:

{ "payload": { "title": "Buy milk" } }

With deny_unknown_fields = true, properties the payload type does not declare are rejected.

Responses​

RouteBody
CommandThe handler's JSON result
.list{ "data": [...], "pagination": { "limit", "offset", "page", "total", "pages" } }
.itemThe row object
.metaThe interface descriptor: fields, field.operator filters, params, composites
ErrorRFC 7807 problem JSON with errcode, errdata, and errhint; see Errors

pagination.total is -1 when counting is skipped (count=false) or capped by query_count_max_rows.

Query parameters​

limit, page, sort, include, exclude, query, qbase, text, count. See Queries: the wire format.

Scopes​

A scope is a path segment, not a query parameter. It narrows a command or query to a sub-context such as a project or a workspace, and it is decoded into a JSON object that policy and handlers can read. A command declares scope: required in its meta; a query resource declares it in meta { scope: … }.

KindEnable withToken configUse
:linklink: true in command meta[riverbase.link_token]: RIVERBASE_LINK_TOKEN_SECRET, RIVERBASE_LINK_TOKEN_SALTOne-click links in email, such as "confirm subscription"
:hookhook: true in command meta[riverbase.hook_token]: RIVERBASE_HOOK_TOKEN_SECRET, RIVERBASE_HOOK_TOKEN_SALTJWT-signed trigger URLs for third-party webhooks

The token carries the command arguments, so a plain GET can run the command safely.

Headers​

HeaderDirectionMeaning
AuthorizationinBearer <JWT>, or MockAuth-… in development
X-ProfileinPin the active profile for this request
Idempotency key headerin and outReplay-safe retries; the response header name is set by resp_header_idempotency
Correlation idoutEchoed for tracing across services

API zones​

Routes can be restricted to deployment zones. With api_zone = ["admin"], only routes allowed in admin are registered, and only they appear in OpenAPI. Use zones to serve a public API and an admin API from the same code in two deployments.