Site Building

Exposing Your API in Drupal 8 for Drupal 8

This page is archived

We're keeping this page up as a courtesy to folks who may need to refer to old instructions. We don't plan to update this page.

Alternate resources

Sprout Video

Core in Drupal 8 comes with a built-in solution for providing creating a REST API without writing a single line of code.

NOTE: We now have a full series on Web Services in Drupal that goes into much more detail about building your API for a decoupled site.

In this lesson we will talk about the core modules that help create a REST API, including:

  • REST module
  • Serializer
  • HAL
  • Basic Authentication
  • and the RESTUI contributed module

Self-check question: Can you find examples in Drupal core of plugins that expose data to the REST server?

Notes:

  • The video covers creating a node (via POST) twice, using two different versions of the Postman Chrome extension.
  • The REST_UI module has been updated since the creation of this video. Rather than providing unique permissions for users it now leverages entity permissions to determine if a user has access to a particular operation or not.

Additional resources

RESTUI — Drupal.org