Module Development

JSON:API Filters on Nested Relationships for Drupal 8, 9, and 10

Includes and filters are really powerful features. When combined together you can achieve almost any query your consumer application needs. Fancy filters we mentioned in a previous tutorial allow us to filter a collection based on fields of related entities, in addition to the fields directly under that entity.

In this tutorial we will:

  • Learn about filtering based on data in related resources
  • Filter based on multiple conditions and multi-value fields
  • Demonstrate how to filter a collection of articles based on author or tags

By the end of this tutorial you should be able to use nested filters in conjunction with relationships to further refine the list of content returned in a JSON:API collection.

Decoupled Headless Drupal