Articles

In the ever-evolving landscape of web development, Drupal 11 stands out as one of the most robust and flexible platforms for building dynamic websites and applications. Its modular architecture empowers developers to tailor and extend core functionalities to meet a wide range of project needs.


Understanding CORS in React
CORS has long been a source of confusion—and frustration—for developers, especially those just starting out. The concept can be tricky to grasp, particularly when you're building single-page applications (SPAs) with frameworks like React, Angular, or Vue and trying to interact with third-party APIs.


The JSON:API module is designed to take the data model defined in Drupal using Drupal's Entity API, Field API and Typed Data API and expose it via an API conforming to the JSON:API specification in order to facilitate interaction with the data (entities) managed by Drupal.
In doing so, it respects all of Drupal's security measures for that data:


Renaming and disabling of resources and fields is now part of core.
When in need for altering resource properties like API path, resource counts or defaults for includes, or you want an interface to disable fields or resources, use JSON:API Extras.


JSON:API is entirely entity-based. That is, it can't process business rules or do things which can't be thought of as "CRUD". Business logic, like registering a new account, logging in a user, or requesting a new password are not part of JSON:API. Many of these are already provided by Drupal core.
A non-exhaustive list of common needs and solutions are presented below.


Кратко (TL;DR)
Используйте REST, если вам нужно работать с данными вне сущностей. Во всех остальных случаях — выбирайте JSON:API.
Более подробно:


Uploading files is now supported, see the release notes for more information: https://www.drupal.org/node/3024331
These two images show how to use postman to test file upload by JSON:API


Some sites may not wish to expose certain JSON:API resource types or fields or may wish to rename fields to provide a cleaner interface.
To allow these alterations, JSON:API dispatches a ResourceTypeBuildEvent
event object using the event name ResourceTypeBuildEvents::BUILD
. Please refer to subscribe to and dispatch events on how to use these events.
Subscribers can call the following methods:


This page shows examples of DELETE requests for the JSON:API module.
Enabling delete operation
Visit /admin/config/services/jsonapi
and check the "Accept all JSON:API create, read, update, and delete operations." option.
