Skip to the content
Documentation
Help Start
Reading in:
  • German: 9,059 of 9,059 pages
About the help in other languages
All help pages

Specification: the explayouts_ui_api editor API

This page is the reference for the JSON API behind the layout editor of the explayouts_ui_api extension (releases 1.0.0 to 1.3.7): its module views, the dispatcher, the form token rule, every endpoint, the write rules…

Download as PDF

Address: https://doc.exponential.earth/exphelp/viewer/specifications/6.0/explayouts-ui-api.md

On this page

Specification: the explayouts_ui_api editor API

This page is the reference for the JSON API behind the layout editor of the explayouts_ui_api extension (releases 1.0.0 to 1.3.7): its module views, the dispatcher, the form token rule, every endpoint, the write rules, templates and translations. Read it if you script layouts, debug the editor, or build your own client. The user-facing description is the feature page.

In short

  • Base path: /explayouts_ui_api/app/api. Responses are application/json; lists are {"values": [...], "total": n}.
  • Reads (GET, HEAD, OPTIONS) need only the admin session. Writes also need the form token as X-CSRF-Token.
  • Only a draft layout can be changed; published and shared layouts are read-only through the API.

Example: read the editor configuration

Sign in to the admin in a browser, copy the session cookie, and run (replace the host and the cookie):

curl -s -H 'Cookie: YOUR_SESSION_COOKIE' https://<admin-host>/explayouts_ui_api/app/api/config

Expected answer (the token value differs):

{"csrf_token":"...","automatic_cache_clear":true,"edition":"Open Source"}

Use that csrf_token as the X-CSRF-Token header of every write request.

Module

Module explayouts_ui_api (modules/explayouts_ui_api/module.php, variable_params on). All views use the policy function read of the module, navigation part ezsetupnavigationpart.

ViewParametersPurpose
appnone (the rest of the path is read by the dispatcher)Editor shell at /explayouts_ui_api/app, API entry /app/api/..., layout preview /app/preview/<layout_id>, block edit form fragments
layoutsLayoutIDRead-only JSON view of one layout
rulesRuleIDRead-only JSON view of one mapping rule
blocksZoneIDRead-only JSON view of the blocks of a zone

Settings shipped: module.ini ([ModuleSettings] ExtensionRepositories[] and ModuleList[] for explayouts_ui_api), design.ini (DesignExtensions[]), site.ini ([RegionalSettings] TranslationExtensions[]).

Dispatcher

expLayoutsUIApplicationApi::handle( $parts ) in classes/explayoutsuiapplicationapi.php. Every response is application/json; list responses use {"values": [...], "total": n}. The dispatcher first checks the form token, then routes by resource. An uncaught Throwable is logged to error.log with a backtrace and answered as HTTP 500 {"error":"Internal error","details":...}.

Authentication and the form token

Same admin session as the rest of the admin. GET, HEAD and OPTIONS need no token. Every other method needs the session token (ezxFormToken::getToken()) as X-CSRF-Token or ezxform_token. Refusals: HTTP 403, Cache-Control: no-store, one warning line in the log, body {"error":{"code":403,"reason":"form_token_missing"}} or "reason":"form_token_wrong". With ezformtoken not active no token is issued and nothing is checked. Request bodies may be application/x-www-form-urlencoded or application/json (requestData() falls back to php://input when $_POST is empty).

Endpoints

All paths below are relative to /explayouts_ui_api/app/api. <locale> is an optional content locale prefix.

Method and pathPurpose
GET /config{"csrf_token", "automatic_cache_clear": true, "edition": "Open Source"}
GET /config/layout_typesLayout types and their zones from explayouts.ini (LayoutType_*)
GET /config/block_typesBlock types in block_types and block_type_groups (grouped by Category)
GET /layoutsList layouts
GET /layouts/sharedPublished shared layouts only
POST /layoutsCreate a draft layout. Body: layout_type (required, else 422 Layout type is required.), name, identifier (a slug of the name when missing). Answers 201
GET /layouts/<id>One layout. ?published=false loads the draft, ?published=true the published version, no query falls back to load()
POST /layouts/<id>/publishPublish the draft (404 when there is none)
POST /layouts/<id>/draftCreate a draft of a published layout (201)
DELETE /layouts/<id>/draftDiscard the draft
GET [/<locale>]/layouts/<id>/blocksBlocks of the layout
GET [/<locale>]/layouts/<id>/zones/<identifier>/blocksBlocks of one zone, as a bare JSON array (the editor takes ids straight off it)
POST /layouts/<id>/zones/<identifier>/link, DELETE ...Link and unlink a zone to a zone of a shared layout, on the draft
GET /<locale>/blocks/<id>, POST/PUT/PATCHLoad and update a block: name, view_type, position, parameters (object keyed by parameter name)
POST /<locale>/blocksCreate a block. parent_position places it; siblings are renumbered
DELETE /<locale>/blocks/<id>Delete; siblings are compacted
POST /<locale>/blocks/<id>/copy, /moveCopy and move, also into containers
GET|POST|PATCH /collections/...Collections: result, change_type, query, items (GET, POST, PUT, DELETE, remove_all)
GET /content_browser/...Content browser data for adding collection items
GET /rules, GET /rules/<id>, GET /mappingsMapping rules with targets and conditions; rule counts per layout_id
/transfer/...Import and export through expLayoutsImporter and expLayoutsExporter
/forms/..., /parameters/...Form and parameter metadata for the block edit sidebar
GET /versions/<layout_id>Draft and published versions
GET|POST|DELETE /share/<layout_id>Share tokens (table explayouts_share)

HTML fragments, relative to /explayouts_ui_api/app: GET /<locale>/blocks/<id>/edit (wrapper, form_block_edit.tpl) and GET /<locale>/blocks/<id>/form (the <form>, form_block_fields.tpl). The form submits to POST /app/api/<locale>/blocks/<id>.

Write rules

  • A block is changed, copied or moved only when it belongs to a draft; otherwise HTTP 403. A draft block cannot be created, copied or moved under a published parent block. New and moved blocks take the zone of the draft.
  • A block of a published shared layout, and any write into a linked zone, is refused for every non-GET block route.
  • Block endpoints resolve to the active draft when no explicit published query is supplied.
  • A linked zone reports block_ids: []; its blocks come from the zone blocks route. The layout payload reports the real shared flag and, per zone, the link normalised to the published layout id.
  • publish() publishes a draft only. It loads the draft (loadDraft()), so it returns false instead of copying the published layout onto itself.

Share endpoint

explayouts_share is created on demand by ensureShareTable() and must match the declaration in explayouts' share/db_schema.dba (indexes idx_share_layout and idx_share_token). MySQL and MongoDB use the MySQL statement (the MongoDB driver reads the key clauses to build its indexes); SQLite has its own spelling. Each result is checked: a failure answers 500, POST answers 201 only with a stored token, GET always returns the documented list, and DELETE reports what happened.

Templates and assets

FileRole
design/standard/templates/explayouts_ui_api/app.tplBootstrap page. Meta tags read by the JavaScript: nglayouts-route-prefix (/explayouts_ui_api), nglayouts-base-path, ngcb-base-path, ezxform-token
.../spa_strings.tplDefines window.nglayoutsSpaI18n from |i18n( 'design/standard/explayouts_ui_api/spa' ) calls, keyed by the English text
.../form_block_edit.tpl, form_block_fields.tpl, form_query_edit.tplBlock and query edit forms
design/standard/javascript/netgen-layouts.jsThe editor bundle. Its l.sync maps options.method (POST, PATCH, PUT, GET, DELETE) to the CRUD verb so that create_new_draft sends POST
design/standard/javascript/explayouts-mobile.js, stylesheets/explayouts-mobile.cssMobile layout

Override templates through the design cascade. Layout types and block types come from explayouts.ini and take effect after a cache clear; no code change is needed.

Translations

Context design/standard/explayouts_ui_api/spa in untranslated, eng-US and ger-DE (123 messages, German complete). Sentences built from pieces are single messages with placeholders (%kind, %language, %name, %count) and have singular and plural forms.

Something wrong on this page? Report an error

Documentation license

This documentation is free documentation, licensed under the GNU Free Documentation License 1.3 or later.

Exponential Copyright © 1998-2026 Exponential Foundation and 7x