How to Create REST API Endpoints with Drupal Views

Nevin Katz
Geek Culture
Published in
12 min readDec 26, 2021

--

Design vector created by freepik.com

While the Drupal Content Management (CMS) system is a popular solution for all-in-one websites, it also works well as a “content warehouse” that other systems can pull from. In this tutorial, we will use Drupal Views to create two API endpoints that an app or website can use to request content from a Drupal CMS. To set the stage for the views, we will first set up a Drupal sandbox site, create a content type, and create some content.

Background

Before we get started, let’s look at a few key terms.

  • API — an interface between systems.
  • REST API — a client-server interface that follows RESTful constraints.
  • API endpoints—URLs that expose information for the client.
  • Decoupled Drupal — a system in which the Drupal server is separate from the client application.
  • Drupal Views—lists of content for people or machines.

Below are more details on each term. If you think you have them down, you can skip down to Setup a sandbox.

API

An API, or application programming interface, is like a “handshake” between two systems. Using specific syntax and naming conventions, an API only reveals information from a system that is necessary for the…

--

--

Nevin Katz
Geek Culture

Developer at EDC. I write about web development and biology. Subscribe at https://buttondown.email/nevkatz for article roundups.