JSON:API
NodeHive is built on Drupal, which ships with the JSON:API module as a core feature. This gives you full read and write access to all content entities using the JSON:API specification.
When to use JSON:API
JSON:API is the best choice when you need:
- Full CRUD operations (create, read, update, delete)
- Complex filtering and sorting with query parameters
- Relationship includes to fetch related content in a single request
- Sparse fieldsets to request only the fields you need
Base URL
https://your-site.com/jsonapiUsing with nodehive-js
The recommended way to consume JSON:API in frontend projects is through the nodehive-js client library. It handles routing, includes, and content fetching with a clean API.
import { NodeHiveClient } from 'nodehive-js';
const client = new NodeHiveClient({ baseUrl: 'https://your-site.com',});
// Fetch a node by pathconst node = await client.getNodeByPath('/my-article');
// Fetch a menuconst menu = await client.getMenu('main');See the nodehive-js documentation for the full API reference.
Direct JSON:API Usage
You can also query JSON:API directly. Some common patterns:
# List all articlesGET /jsonapi/node/article
# Get a specific node by UUIDGET /jsonapi/node/article/{uuid}
# Include related fields (e.g. images, tags)GET /jsonapi/node/article/{uuid}?include=field_image,field_tags
# Filter by field valueGET /jsonapi/node/article?filter[status]=1&filter[field_category.name]=News
# Sparse fieldsetsGET /jsonapi/node/article?fields[node--article]=title,field_body,field_image