JSON:API Node Preview
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
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 |