This project is not covered by Drupal’s security advisory policy.

⚠️ Development status

Entity Gateway is currently under active development and is not yet ready for production use. The first beta release is planned for the end of August 2026. APIs, configuration options, and behavior may change before the beta release.

Entity Gateway provides a simple, configurable REST API for exposing selected Drupal entities and fields to frontend applications, mobile apps, and integrations.

Administrators choose which entity types, bundles, and fields are available. Entity reference fields can be automatically expanded into related entity data, providing API responses that are easier to consume without requiring custom REST resources.

Features

  • Configurable resources: Choose which entity types, bundles, and fields are exposed.
  • Simple REST endpoints: Access resources through predictable URLs such as /api/node/article.
  • Automatic relationship expansion: Entity references return related entity data instead of only internal IDs.
  • Nested relationships: Relationships can be expanded up to three levels deep.
  • Built-in filtering: Filter collections through query parameters using common comparison and text operators.
  • UUID reference filtering: Entity reference fields can be filtered using referenced entity UUIDs.

Entity Gateway is intended for projects where Drupal acts as a structured content backend and consumers need a simpler JSON representation of entities and their relationships.

Configuration

No Drupal content is exposed by default.

1. Select entity types

Go to:

/admin/config/services/entity-gateway

Choose the entity types that should be available through the API.

2. Configure resources

Go to:

/admin/config/services/entity-gateway/resource-list

Select the bundles and fields that should be exposed.

3. Consume the API

Resources are available using:

/api/{entity_type}/{bundle}

For example:

GET /api/node/article

Entity reference fields included in the resource are automatically resolved according to the configured resources.

Relationship expansion is limited to three levels to prevent uncontrolled recursive loading.

Administrators should expose only the entities and fields required by API consumers.

Requirements

Entity Gateway supports Drupal 10 and Drupal 11.

The Drupal core Serialization module must be enabled.

No third-party PHP libraries or contributed modules are required.

API filtering

Collections can be filtered using the filter query parameter.

Basic filtering

GET /api/node/article?filter[status]=1

Filtering with an operator

GET /api/node/article?filter[created][operator]=>=&filter[created][value]=1700000000

Supported operators:

  • =, !=, <, >, <=, >=
  • IN, NOT IN, LIKE
  • contains, start_with, end_with

Custom Drupal fields can be queried without the field_ prefix.

For example:

GET /api/node/article?filter[category]=desserts

is applied internally to field_category.

Comma-separated values are treated as an IN condition:

GET /api/node/article?filter[category]=desserts,pizza,salads

Entity reference fields are filtered using referenced entity UUIDs:

GET /api/node/article?filter[category]=d0f7a6a0-9a2e-4c83-9d9a-111122223333

Unsupported operators return HTTP 422 Unprocessable Entity.

Similar projects

Drupal core JSON:API

JSON:API is the recommended choice when consumers need the standardized JSON:API specification.

Entity Gateway focuses on simpler responses, explicit field exposure, built-in filtering, and automatically expanded entity relationships.

Drupal core REST

Drupal core REST provides the foundation for building REST APIs.

Entity Gateway focuses on quickly exposing selected entity data through configuration without requiring a custom REST resource for each endpoint.

Contributing

Entity Gateway is an open source Drupal project. Bug reports, testing, documentation improvements, patches, merge requests, and API use-case suggestions are welcome.

Configuration details and additional API examples are maintained in the project documentation and README.

Built by a human using an AI assistant: 🤖 ➕ 🧠

Parts of this module were generated with AI coding agents under human supervision.

Project information

Releases