OpenFolia

Preview a module as HTML

GET
/modules/{lang}/{id}/preview

One module in one language as a page for the editor’s live preview, with the conditions inside it applied for variant. Read like every other module read: ?ref= may name a branch (a change set’s, for its author), and a module the reader may not see is 404, exactly like a missing one. The editor’s view: a page break shows as a marker labelled “Page break (PDF)”, and a text attribute ({product-name}), which a module on its own has no value for, as a chip with the attribute’s label, titled “Not set for this preview”.

Authorization

bearer
headerAuthorizationBearer <JWT>

A service account's token (ccms_sat_…, issued by POST /service-accounts/{id}/tokens), or, for local use and demo mode, the server's shared CCMS_API_TOKEN.

Path Parameters

lang*string
Match^[a-zA-Z]{2,3}(?:-[A-Za-z0-9]{2,8})*$
id*string
Match^[a-z0-9]+(?:-[a-z0-9]+)*$
Lengthlength <= 100

Query Parameters

variant?string

The variant to apply the module’s conditions for, as a slug (model=large,software=2.3; attributes and values as configured). Default: none set, so a condition on a variant attribute does not hold.

Lengthlength <= 500
theme?string

Colour scheme. auto (default) follows the viewer’s prefers-color-scheme; light and dark force one.

Default"auto"
Value in"auto""light""dark"
ref?string

Branch, tag or commit ID to read from. Default: the server's CCMS_DEFAULT_REF.

Response Body

A complete HTML page (@openfolia/render-html) linking the theme and the renderer’s stylesheet, served with Content-Security-Policy (no script; styles, images and fonts from this origin; frame-ancestors this origin and CCMS_EDITOR_ORIGINS) and X-Content-Type-Options: nosniff. Images are GET /assets/:sha256 and safety symbols GET /symbols/:id (those with artwork; the configured label as the text alternative), at the same ?ref=. Cached like every content route.

response?stringtext/html
Example Request
curl -X GET 'http://localhost:3000/modules/en/battery-charging/preview'
Example Response
"string"