Real World Websites Using the WordPress REST API in Cool and Unexpected Ways
For most of us, the WordPress REST API feels like something experimental, something we might be developing our skills on or experimenting with.
I know there are plenty of developers out there who are playing with the API, testing what it can do and using it to build personal projects and experimental sites. And that’s great: by doing this we learn about the possibilities the API offers and can share that with other developers.
But did you know that there are quite a few sites already using the WP-REST API? These aren’t restricted to small, experimental sites either. Some big names in web publishing like Wired and the New York Times are already making use of the REST API and the possibilities it offers.
In this post, I’m going to look at some of the sites already using the REST API, detail what they’re doing and try to find out how it’s benefited them and what they’ve learned from it. So read on!
Note: While researching this post I made use of the REST API White Paper created by Human Made. Thanks to them for putting such a comprehensive and useful resource out there – I recommend that anyone interested in the REST API gives it a read.
The Wired site isn’t built with the REST API, but it does make use of the API to manage data exchange with third party services.
There are two ways in which Wired is using the REST API: to share data with a third party source and to provide links in the site.
Like many news sites, Wired has links on its pages (usually under the content) that take you to other articles around the web you might be interested in. Again like lots of other news sites, it uses Outbrain, a third party service, for this. But Wired uses the REST API as a fallback if Outbrain goes down or isn’t feeding the links to their site. If that’s the case, their site accesses the same data that’s been set up to go to Apple News and outputs that as links in the page.
ThemeConf is a conference taking place this September for theme developers, with a focus on the REST API. It made sense therefore to build its website using the API.
Because the REST API means they can pull content in from third party sources, journalists can also post copy to the live blog from Slack, meaning they don’t have to leave what they’re doing and log in to the main website. This makes it easier for journalists who aren’t at a desk.
UsTwo are a digital agency whose site was built as a Single Page Application using the REST API. They wanted to combine a front-end built using React with a backend powered by a reliable open source CMS.
The content of their single page is modular, with a structure that’s different from a standard WordPress page. To make this work, they use a custom page builder plugin that lets authors add modular content to the site.
NPM chose to use the REST API on their website for security reasons. They wanted a secure way to deliver content to different areas of the page without having to access IP addresses that weren’t whitelisted.
Their site is built using JSON with Handlebars templates to deliver content. The REST API doesn’t just send content to the site: it also sends rendered HTML, scripts and stylesheets.
Calypso works as a web app and as a desktop app, using the REST API to access the content on your WordPress.com sites and let you add new posts, edit existing ones and more. You can find out more about it in our guided tour of Calypso.
This Short List Shows How Broad the Possibilities Are
Each site I’ve listed above is different and uses the REST API to achieve different things. In some cases, that’s about the user interface; in others it’s about interacting with third party services; while in others it’s about security.
This demonstrates just how broad the possibilities are for developing with the REST API. The number of sites out there using it isn’t huge right now, but it’s growing, and with the possibilities it offers, the number is only set to explode in the future.