Skip to content

Hyvä CMS APIs

Hyvä CMS exposes REST APIs for admin integrations and GraphQL queries for published content. Both cover more than CMS pages and blocks: depending on the installed modules they also reach product and category attribute content, menus, and other Hyvä CMS content types.

REST and GraphQL serve different use cases:

  • Use REST for authenticated admin CRUD workflows, integrations, migrations, and automation.
  • Use GraphQL for storefront or frontend consumers that need published Hyvä CMS output.
Available since Hyvä CMS 1.1.0

The REST and GraphQL endpoints for Hyvä CMS pages and blocks are available from Hyvä CMS 1.1.0, released with Hyvä Commerce 1.1.0.

Hyvä CMS REST API

Hyvä CMS REST endpoints require Magento admin-token authorization.

From Hyvä CMS 1.3.0, REST routes are gated by the Hyvä CMS ACL resources.

The full REST reference is generated by Magento from the installed service contracts. In developer mode, open:

https://your-store.example/swagger

Developer mode required

Magento's Swagger UI is available in developer mode. In production or default mode, the Swagger UI is normally unavailable.

What The REST API Covers

Hyvä CMS registers service contracts for its content types, including CMS pages and blocks, product and category attribute content, scheduling, and templates and snippets. The exact set of endpoints depends on your Hyvä CMS version and installed modules, so rather than list them here, use the Swagger reference above, which is always accurate for your environment.

The REST endpoints for product and category attribute content are available from Hyvä CMS 1.2.0.

Endpoint families follow Magento's standard service-contract conventions, with GET /:id, GET /search, POST, PUT /:id, and DELETE /:id operations where supported.

Import/Export Versus REST

The editor Import/Export is not the same as the public REST API. Import/Export is an admin editor workflow for ZIP packages and current-item JSON. Use it when moving authored content, media, translations, history, and instance components between environments.

Use REST when an integration needs direct CRUD access to Hyvä CMS entities.

The Import/Export is also extensible: third-party modules can register their own content types so they appear in the export picker and ZIP packages. See Step 12: Register with Import/Export.

Hyvä CMS GraphQL API

The Hyvä CMS GraphQL API exposes published Hyvä CMS content for frontend use. Beyond CMS pages and blocks, it also covers product and category attribute content and menus, depending on the installed modules.

GraphQL access is public and does not require admin authentication. Ordinary storefront queries expose published content. Supported queries also accept a preview capability for the queries described below; keep preview tokens private to the review workflow.

Example queries include hyvaCmsPage, hyvaCmsBlock, and hyvaCmsBlocks for pages and blocks, plus hyvaProductAttribute (by productId or sku) and hyvaCategoryAttribute (by categoryId) for attribute content. Responses can include published content, rendered HTML, and Tailwind CSS. Check your instance's GraphQL schema for the authoritative, up-to-date list of queries and fields.

Published content and rendered HTML are only returned when liveview is enabled for that entity, mirroring the storefront. When it is disabled, those fields come back empty even though the query succeeds.

For general Magento GraphQL usage, see Adobe Commerce's GraphQL overview.

Preview Access

The optional preview argument is available on hyvaCmsPage, hyvaCmsBlock, hyvaCmsBlocks, hyvaProductAttribute and hyvaCategoryAttribute. Pass the liveview_preview value from a valid Hyvä CMS preview URL. The server validates the capability for the content being requested, allowing preview access to content that is disabled or outside the current store assignment.

The preview argument is available from Hyvä CMS 1.3.0.

The current page and block data providers still read published_content and published Tailwind CSS, even when a preview capability is supplied. The argument relaxes availability checks; it does not expose the unsaved browser draft.

Without a valid preview capability, storefront availability rules still apply. Check the installed schema and response fields when building a headless preview; this argument is not an admin authentication token or a general bypass for unrelated content.

hyvaCmsBlocks accepts at most 50 identifiers in one request. Split larger lookups into batches. This limit applies from Hyvä CMS 1.3.0.