Building APIs with Drupal
Drupal 10 comes with several awesome features to help facilitate building out RESTful APIs using the core Serialization and JSON:API modules. These enable you to build headless and/or decoupled solutions that can still interact with and query for data in Drupal.
In this chapter, we will look at how to do the following:
- Fetching data from Drupal using JSON:API (https://jsonapi.org/)
- Using POST to create data with JSON:API
- Using PATCH to update data with JSON:API
- Using DELETE to remove data with JSON:API
- Using Views to provide custom data sources
- Using OAuth methods
The Serialization module provides a means of serializing data to or deserializing from formats such as JSON and XML. The RESTful Web Services module then exposes entities and other resource types through web APIs. Operations done over RESTful resource endpoints use the same create, edit, delete, and view permissions that would be used in a non-API context. The...