Advanced web services with JSON API
JSON API is more than a specification that paints your bike shed. It prevents endless meetings about payload structures and query string parameters and puts the focus on the hard problems.
In this session you will learn to use JSON API to make complex requests that interact with data like:
- Give me the cover image and the publication year of all the albums of all the bands having one of the members currently living in Murcia. Oh! And while you're at it, output the name of the band and that member as well.
- I'm sending a JSON document with the information about an article, its tags, its images and its author details. Let me know when you have created/updated all those entities and linked them together.
All this in a single HTTP request!
Traditional REST implementations, including REST in core, typically suffer from these different problems:
- Too many requests are needed to get the whole data graph needed to construct the view in the consumer.
- There is a significant response bloat returning all the fields and relationships of every entity.
- Listing and finding content based on the data attributes of the entities or their relationships.
- Versioning the API so consumers and back-end implementations can iterate separately.
There are several specifications in the wild that addess this problem in a very similar way because the solutions to these problems is known, being GraphQL and JSON API the most prominent ones.If you have had to build a decoupled app, or you have been working on progressively decoupled subsystems in your Drupal project (or you have been wishing to) this session is for you.