Skip to main content
drupalreleases
Release: Cms 2.2.3 — Update released for Drupal core (2.2.3)! Release: Easy Breadcrumb 2.0.11 — Minor update available for module easy_breadcrumb (2.0.11). Release: Bootstrap 8.x-3.42 — Minor update available for theme bootstrap (8.x-3.42). Release: Editoria11y Accessibility Checker 3.0.10 — Minor update available for module editoria11y (3.0.10). Release: Editoria11y Accessibility Checker 2.2.24 — Minor update available for module editoria11y (2.2.24). Release: Leaflet 10.4.13 — Minor update available for module leaflet (10.4.13). Release: Flag 5.1.1 — Minor update available for module flag (5.1.1). Release: MCP Sentinel 2.33.0 — Minor update available for module mcp_sentinel (2.33.0). Module Revived: Bootstrap 8.x-3.41 — Theme bootstrap updated after 6 months of inactivity (8.x-3.41). Security Coverage: Component Library — Module component_library now has official Drupal security advisory coverage.

JSON:API Node Preview

1,259 sites Security covered
View on drupal.org

This module adds a `/preview` endpoint to the JSON:API for nodes. This allows you to get a preview of a node's content in JSON:API format by appending `/preview` to the node's JSON:API path. This preview endpoint is not cached and is only accessible to the authenticated user who created the preview.

A module to get node previews in JSON:API.

It adds a new endpoint for all JSON:API resources of type node, adding a
/preview string to the end of the original JSON:API path.

For example:

  • Node / Article : /jsonapi/node/article/{UUID}/preview
  • Node / Page : /jsonapi/node/page/{UUID}/preview
  • etc

That endpoint is compatible with any other JSON:API parameters available
(fields, include, etc).

The expected workflow to make this module work is as following:

  • Edit any node and click on "Preview" button
  • A new window opens, with a URL like this: http://example.com/node/preview/1f8b435a-0026-4628-93f3-38ae7353ffbb/full
  • Grab the UUID (the "8-4-4-4-12" chars, "1f8b435a-0026-4628-93f3-38ae7353ffbb" in this example)
  • Execute a request to /jsonapi/node/article/1f8b435a-0026-4628-93f3-38ae7353ffbb/preview

Being a preview operation, this endpoint:

  • is not cached.
  • is authenticated, so it is only available to the same authenticated user that created the node preview (please do not open an issue about how to get anonymous access to node previews, since that is a security breach).

You can use any UUID to request the preview endpoint. If that UUID has not been
previewed, or the user making the request has not enough permissions, JSON:API
responds with a 404 error.

REQUIREMENTS

  • Node module
  • JSON:API module

INSTALLATION

Run composer require drupal/jsonapi_node_preview.

CONFIGURATION

Install it and it works. There's no configuration, no UI.

SIMILAR MODULES

Visit https://www.drupal.org/project/graphql_node_preview for a version of this module for GraphQL.

Depends on

Dependencies of the latest stable release

No dependencies recorded for this project.

Required by

Tracked projects that depend on this one

No tracked projects depend on this one yet.

Activity

Tracked releases
3
Tracked since
Dec 2023
Latest release
1 month ago
Releases (12 mo)
1
Maintenance
Active

Release Timeline

Releases

Version Type Core Release date
1.0.0-beta5 Pre-release 9–11 Aug 21, 2026
1.0.0-beta4 Pre-release 9–11 Oct 28, 2024
1.0.0-beta3 Pre-release 9–11 Dec 29, 2023