Headless Drupal

The Gizra way


  • Preparing a Restful endpoint in the backend
  • Consuming the API on the frontend
  • Real time notifications

Grab the code:



RESTful is a way to communicate between a provider (Drupal) and a consumer (JS application) using several fundamentals operations:


The Restful module

  • Maintained by amitaibu and e0ipso
  • Avoid drupalisms
  • Supports versioning
  • Supports multiple formats
  • Build for developers


There are couple of ways to authenticate using the RESTful module but let’s talk about something a bit more “global” - access token.

Access token is a string contains odd characters and numbers which represent the user in the system. We will pass the access token in each request.

$http.get('http://localhost/drupal/api/login-token', {
  headers: {
    'Authorization': 'Basic ' + Base64.encode(username + ':' + password)

Coding time

Creating content (POST)


How do you call an Elm developer?


  • Elm is a purely functional language
  • For creating web browser based graphical UIs
  • It’s compiled into javascript
  • Focused into usability, performance and robustness
  • Statically typed

On the business side:

  • Clients pay for the features, not the bugs.
  • Compilation errors VS Runtime exceptions

On the dev side:

  • Easy testing
  • Quick development
  • It’s super fun

The Elm Architecture

  • A model to represent our data
  • A view for representing the model
  • Messages for the operations we can do with our model
  • An update function to modify our data

Elm 101


Union types

Dealing with Union types

Records and functions

Coding time


Real time notifications

There are two ways of communication

One way direction (HTTP)

Bidirectional (phone call)


Websocket is a communication protocol which connect a server and a client and allow to stream data regularly.


Pusher is a service that allows us to keep track of the active users and send them notifications in real time.


Want to see more?


Find me around

Headless Drupal

By david_hernandez

Headless Drupal

Headless Drupal: The Gizra way. Session for DrupalCamp Spain 2017

  • 1,258
Loading comments...

More from david_hernandez