Module Development

JSON:API Error Handling for Drupal 8, 9, 10, and 11

Sometimes unexpected things happen and Drupal needs to generate an error. The JSON:API specification describes how the server should return those errors. Understanding what to expect allows consumers to plan for errors and react gracefully.

In this tutorial we will:

  • Discuss how HTTP errors are used in conjunction with JSON:API
  • Learn about how JSON:API embeds information about the error encountered into the response object

By the end of this tutorial, you should have a basic understanding of the types of errors you can expect to receive when making JSON:API requests and what you can do to handle them.

Decoupled Headless Drupal