Template

Create a new template

Changed on

Creates a new working version of a template. The 'theme' field in the form corresponds to the theme folder identifier (referred to as 'themeId' in other endpoints). If a layout is provided, the template is saved as a designed (drawed) template with its layout.

When drawed is true (a layout-designer template): body is REQUIRED and must be non-empty (a null body returns 400 'body required when drawed'), and theme MUST resolve to a theme folder identifier — a host id or other non-folder id returns 400 'theme must be a folder identifier'. Provide drawedBody (the layout JSON) as well so the template is a real drawn template.

For a themed drawn template, body is a generated compatibility shell and is not the render source; rendering flows through the theme's template.vtl and drawedBody. The stored shell may contain /themes/null/ even when theme and themeName are correct. That value is benign for this template kind, and PUT-updating body will only cause the shell to be regenerated.

post/api/v1/templates

Request

Request body

siteIdstring

Identifier of the site (host) where this template will be created. This is a site identifier UUID, not 'hostId'. If not provided, the template is assigned to the site resolved from the current HTTP request context.

identifierstring

Identifier of the template. Required for updates, ignored on creation.

inodestring

Inode (version identifier) of the template. Server-managed; typically omitted on input.

bodystring

Raw Velocity markup that renders the template. Required even when 'drawed:true' — send an empty string ('') when using the layout builder ('layout') instead of hand-written body.

selectedimagestring

Identifier of the image asset currently selected as the template thumbnail in the UI.

imagestring

Identifier of the image asset used as the template thumbnail.

drawedboolean

Whether this template was built with the visual layout builder. When true, provide 'layout' (the row/column/container structure); when false, provide 'body'.

showOnMenuboolean

Whether this template should appear in navigation menus.

drawedBodystring

Velocity body generated by the layout builder for a drawn template. Server-managed.

countAddContainerinteger

Count of 'add container' placeholders in the layout. Server-managed; typically omitted.

countContainersinteger

Count of containers in the layout. Server-managed; typically omitted.

headCodestring

Velocity/HTML injected into the page <head> for pages using this template.

themestring

Theme folder identifier (not a path) that supplies the template's CSS/JS and VTL fragments. Resolve the folder identifier from a path via GET /api/v1/folder/sitename/{site}/uri/{uri}.

themeNamestring

Display name of the theme. Informational; 'theme' (the folder identifier) is authoritative.

footerstring

Velocity/HTML footer fragment for pages using this template.

friendlyNamestring

Friendly (human-readable) name of the template.

headerstring

Velocity/HTML header fragment for pages using this template.

namestring

Internal/asset name of the template.

titlestring required

Title of the template (displayed in the UI).

sortOrderinteger

Sort order for display purposes.

headerCheckboolean

Whether the header fragment is enabled for this template.

footerCheckboolean

Whether the footer fragment is enabled for this template.

Response

Template created successfully

i18nMessagesMapobject
permissionsstring[]

Changes

    • breaking

      request body became required

    • breaking

      removed the media type */* from the request body

    • info

      api operation id saveNew_3 removed and replaced with createTemplate

    • info

      api tag Template added

    • info

      added the media type application/json to the request body

    • info

      added the non-success response with the status

    • info

      added the non-success response with the status

    • info

      added the success response with the status