What will you learn
- How to build and design RESTful APIs
- Modern web services with JSON:API and GraphQL
- Install and set up the JSON:API module
- Learn to request, sort, and paginate lists of entities using JSON:API collections
- Learn how to install and set up the Simple OAuth module
- Learn to use Drupal and React together
Overview
In this guide you will learn to build a RESTful API to use in a decoupled Drupal application, such as one that uses Drupal and React together.
Web Services in Drupal, including headless configurations and JSON:API, enable seamless integration and data exchange with external applications and devices, supporting modern decoupled architectures and enhancing the flexibility and reach of Drupal sites.
Drupal's JSON:API provides a standardized and efficient way to expose and consume Drupal content as JSON data, facilitating integration with front-end frameworks and external applications in a decoupled architecture.
Some interactions (like CRUD operations) require prior authorization, by using the contributed Simple OAuth module Drupal can securely authenticate and authorize API requests in a decoupled Drupal environment.
Integrating React with Drupal enables the creation of dynamic and interactive user interfaces while leveraging Drupal's robust backend for content management, supporting modern web application development.
Courses
Web Services
This course covers the basics of web services, the principles of RESTful APIs, and the use of modern web service solutions like JSON:API and GraphQL. Additionally, learners will explore the importance of separating content from presentation, the implications of hosting decoupled architectures, and best practices for API documentation.
JSON:API in Drupal
This course covers the installation and configuration of the JSON:API module, making resource requests, handling relationships, and using advanced features like sparse fieldsets and filtering collections. Additionally, learners will explore error handling, security considerations, and best practices for building robust and efficient Web Services APIs using Drupal core’s JSON:API module.
API Authentication
This course covers the installation and configuration of the Simple OAuth module, obtaining and using OAuth 2 tokens, and making authenticated requests to create, update, and delete entities. Additionally, learners will explore handling cross-origin resource sharing (CORS) to ensure secure and efficient communication between the client and server.
React and Drupal
This course covers the basics of React, the differences between decoupled and progressively decoupled architectures, and how to connect React to a Drupal theme or module. Learners will also get hands-on experience retrieving and manipulating data from Drupal using JSON:API, handling authentication with OAuth, and building fully decoupled React applications.
React is a JavaScript library that makes it easy to create interactive user interfaces. This course is for developers who want to get their hands on some code and who learn best by doing. We're assuming that you already have a basic understanding of Drupal administration and are comfortable with doing things like creating content and users, installing modules, and configuring your application. We also expect that you're already familiar with JavaScript.
Need to brush up first?
- Check out the Drupal User Guide on Drupalize.Me
- And this course on JavaScript from freeCodeCamp.org