Module Development

JSON:API Collections for Drupal 8, 9, and 10

JSON:API includes a way to request a list of entities of a given resource from the server. Collections are the best way to find content based on filters, and to build listings into the consumers. Moreover, collections can be combined with all the options you can apply to a single resource, like sparse fieldsets and includes.

In this tutorial we'll:

  • Learn about what collections are in JSON:API
  • Learn how to request, sort, and paginate lists of content

By the end of this tutorial you should know how to retrieve a list of resources from the JSON:API server, and how to optionally sort and paginate the items in the list.