Introducing the New Block Data API
Today, we are releasing the Block Data API publicly to all WordPress VIP customers.
The new Block Data API radically simplifies the work of developers when building applications that consume CMS data, ensuring they’re able to apply the world’s most widely used, most intuitive, most flexible, and most open CMS—WordPress—for all their content management use cases.
The impact of headless CMS and APIs
One of the biggest changes in content management is the emergence of the headless CMS. Increasingly, organizations want more control over their front-end and to compose experiences from different applications, such as CMS, DAM, commerce, etc. What started with a few commerce use cases is gaining a foothold throughout the enterprise.
Headless CMS has its pros and cons.
CMSes like WordPress support this type of architecture very well. Gutenberg transformed the way WordPress structured content, shifting away from traditional pages to more modular, block-based content. This made it easier to pull and assemble content components. To do so, however, developers need to effectively get data in and out of the CMS via APIs while minimizing the complexity and maintenance required as things change, both on the frontend and backend.
HTML: A blessing and a curse
WordPress, like most CMSes, heavily utilizes HTML. This makes sense as HTML is such a widely used standard, browsers are ubiquitous on most devices, and the number of HTML libraries and parsers are nearly endless. That HTML ubiquity has made the web what it is.
However, there are times when the “M” in HTML—markup—can be an encumbrance or overkill, for example, when building a headless frontend, a mobile application, or feeding a data model for machine learning. In those cases, developers just want clean JSON of just objects without any sort of formatting.
To bridge this gap, developers often build or use parsers to strip out superfluous markup and clean the data for use in their application. This generally works, but takes developer time and effort. Furthermore, if the structure of the HTML the CMS produces changes, the parser may need updating, creating a maintenance and testing burden (and introducing room for error).
Making Gutenberg speak data
A better way to do this is have the CMS APIs simply return clean JSON data with no post-processing required. This has been possible via GraphQL; however, most developers still use REST APIs, and here they’ve had to develop workarounds.
Supporting customers accessing Gutenberg block via REST, our new RESTful API—the Block Data API—eliminates the need for client-side parsing layers, and returns JSON data ready for use.
During the beta of this API, our customers have enjoyed notable improvements in the speed of building their applications and maintainability of those applications over the long term.
For example, Sinash Shajahan, Principal Engineer at TIME said: “The Block API plugin has been a true game-changer for our transition to Gutenberg. As a 100% headless solution, we were searching for a replacement for our current content parser that could seamlessly integrate with the Gutenberg editor. The Block API plugin provided the perfect solution.”
Now it’s your turn
To begin using our new Block Data API or to learn more, we encourage you to reach out to your WordPress VIP technical account manager and review our technical docs for additional information.