“After soliciting input and consulting others, I felt JSON:API belonged in Drupal core.”
Dries Buytaert, creator of Drupal
Here is the news that will make the supporters of API-first Drupal simply lose their breath. Among the new features of the freshly released Drupal 8.7.0, is JSON:API in Drupal core! It is now part of Drupal 8 web services responsible for data exchange with third-party applications. Let’s learn more about JSON:API’s work, its road to Drupal’s “main squad,” and why JSON:API in Drupal core as of the release 8.7 is a significant achievement.
API-first Drupal future has arrived
New times dictate new trends. Businesses today can benefit from much more than just websites. They can embrace different channels through the “Create Once, Publish Everywhere” (COPE) method. Their content can “fly” to mobile applications, Internet of Things devices, and so on, via an API.
Being API-first means being fully ready for this interaction. API-first Drupal future has been the Drupal community’s priority in a recent couple of years. The new Drupal 8 in 2015 came packed with a REST API, which became more and more enhanced in the subsequent minor releases. This is the result of the API-first Drupal Initiative and hard work of the community.
In addition to Drupal 8 core RESTful web services, there emerged an ecosystem of projects for API-first Drupal:
- contributed modules like GraphQL, Simple OAuth, Open API, Consumers, RELAXed Web Services, Subrequests etc.
- decoupled distributions Contenta CMS, Reservoir, and Headless Lightning
- Waterwheel.js SDK
Among the tools, of course, the JSON:API contributed module, which has now finished its way to Drupal core. Congrats!
The road of JSON:API to Drupal 8 core
The JSON:API specification was increasingly popular in the JavaScript community. Dries Buytaert in 2017 recommended the young JSON:API contributed module for Drupal 8 core. As the Drupal creator said, he felt JSON:API belonged there. Still, enormous work was ahead.
The module’s main creator and maintainer was Mateu Aguiló Bosch (e0ipso). But Dries asked Wim Leers and Gabe Sullice of Acquia to devote as much time as possible to helping to get this module ready for the core. Overall, as Wim Leers wrote in his article, the project had as many as 103 contributors.
According to Dries Buytaert, by the time JSON:API was committed to Drupal 8.7 branch, it had taken:
- 28 months
- 450 commits
- 32 releases
- 5,500+ test runs
Record-breaking module: immediately stable in core!
Usually, Drupal contributed modules are added to the core as experimental and only become stable when polished to perfection. However, JSON:API was the first module in history to be added to Drupal core as stable from day first! This is what Mateu Aguiló Bosch, the module’s main creator, said.
How JSON:API module works
When enabled, JSON:API in Drupal core immediately makes your Drupal entities (blog posts, users, comments or whatever) available via a web service API. For JSON:API, your entities are resource objects. It creates URLs by which the entity types and bundles can be accessed using HTTP methods.
According to Dries, both developers and content editors can create their content models directly in the Drupal user interface. In addition to the great authoring experiences, Dries said, they get a powerful and standards-compliant web service API that allows to pull this content to JS applications, digital kiosks, chatbots, voice assistants, and so on.
It is possible to:
- fetch the selected entity fields only (for example, blog titles)
- include relationships (for example, blog authors) and avoid additional requests
- filter the resource collections
- sort of the resource collections
- do the pagination of the resource collections
and much more.
What this news means for the users of JSON:API contributed module
According to Wim Leers, the users of JSON:API 8.x-2.x contributed module on Drupal 8.5 or 8.6, can simply update to Drupal 8.7 and delete the contrib. There should be no disruption in its work. Please note that the contributed module will no longer be supported by the end of 2019.
Update to Drupal 8.7 and enjoy JSON:API in core!
Congrats again to the tireless team of JSON:API creators! The API-first Drupal approach gives us unlimited freedom in fulfilling our customers’ third-party integration ideas. So if you wish to: smoothly update to Drupal 8.7 create data exchange solutions with JSON:API in Drupal core expand your business reach to new channels contact our Drupal developers!