Fetching data from Drupal using JSON:API
With just a few clicks, we can open up and expose data from Drupal to consume from external services. This will enable us to ask Drupal for data and return it to us in JSON, making it easy to consume.
Getting ready
First, we need to enable some core modules. Head to Admin | Extend and enable the following:
- HTTP Basic Authentication
- JSON:API
- RESTful Web Services
- Serialization:
Figure 12.1 – Enabling the necessary modules in Drupal
The JSON:API module users the Serialization module to handle the normalization of a response and denormalization of data from requests. Endpoints support specific formats (JSON, XML, and so on), and authentication providers support passing authentication in the headers of requests.
Important note
Note that at the time of writing, multilingual support is still being finalized under JSON:API. You can track the status of this issue here: https:/...