Last updated February 3, 2020
Module Development8.9.x/9.0.x

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.