Web Services in Drupal 8

Drupal 8 has a rapidly developing and powerful toolset for working with web services. More and more sites are moving to a decoupled CMS architecture. Even if you are not creating a fully decoupled site, exposing aspects of your site through a web service API is a common task in modern web development. This series will teach you everything you need to know in order to use Drupal core and contributed modules to build a web services API with Drupal as the backend.

This series looks at important topics regarding the architecture of your API like presentation versus content, security, and documentation. It also examines common pitfalls in REST APIs and how to address them in order to ensure consistency and performance. Throughout the series the examples are primarily focused on creating a REST API that uses the JSON API specification, but the concepts apply equally well to GraphQL or other formats.

For the purpose of this series, we are going to talk about APIs as the collection of features provided by Drupal modules that allow us to read and write content (nodes, taxonomy terms, users, etc.) and configuration (blocks, menus, permissions, etc.) using HTTP messages. During the course of this series, we will assume some level of familiarity with HTTP concepts such as its methods (often called verbs) and headers. However, we'll provide links to additional resources for these concepts along the way, just in case you need a refresher.

Note: Just getting started with the idea of decoupling, or the concept of headless Drupal? Take a look at our Decoupled Drupal series to learn what these terms mean, and when and why you might want to build a web services API with Drupal. Then come back here and learn how to do exactly that.

Author, Mateu Aguiló Bosch

We are very honored to present this series written by Mateu Aguiló Bosch (e0ipso). Mateu is one of the creators of the Drupal JSON API module, amongst others, and a member of the Drupal 8 API-first initiative team. He's also part of the team that created Contenta CMS, an API-first Drupal distribution designed to be a great platform for decoupled Drupal projects.