If you pay any attention to the WordPress ecosystem, you’ve probably heard about the WordPress REST API. The REST API featured heavily at Matt Mullenweg’s State of the Word 2016 address, and it’s just generally a hot topic in the WordPress community.
And guess what? As of WordPress 4.7, the REST API is officially included in the WordPress core software. It’s here. But unless you’re a developer, the WordPress REST API probably remains a mystery to you.
So what is the WordPress REST API? And how does it apply to you, a regular WordPress user?
Just like my post on WP-CLI – this discussion of the REST API is not targeted towards developers. That ain’t me, and I couldn’t do it justice. Instead, this is the REST API for dummies guide.
If you’ve ever wondered what it is and what functionality it can add to WordPress and/or your site, then keep on reading.
What Is The WordPress REST API? In Language Humans Can Understand
If you ask the official REST API site, you’d get an answer that sounds something like this:
“The WordPress REST API provides an easy-to-use set of HTTP endpoints that let you access your site’s data in simple JSON format”.
Well, that’s not very helpful, is it?
So let’s try to break it down in language that a human can understand. To do that, we’ll need to define a few terms.
What is an API?
API stands for application programming interface. Again, not very helpful. But here’s all that really means for our uses…
It allows two pieces of software to interact with each other in an organized fashion. Nowadays, APIs power a huge chunk of the web.
For example, if you have a MailChimp email opt-in form on your site, your newsletter plugin probably uses MailChimp’s API to transfer the information from your email opt-in plugin to the actual newsletter list in your MailChimp account.
So that’s all it is – a way for two pieces of software to interact with one another.
What is REST?
REST, short for representational state transfer, is one way to build an API. The actual specifics of how REST works are important for developers but don’t really matter that much as far as us regular users are concerned.
So What is the WordPress REST API?
Alright, let’s put it all together now…
The WordPress REST API is an API built on REST technology that allows your WordPress site to interact with other pieces of software in cool and interesting ways.
For example, you could build a separate web app that’s able to pull posts or user information from your WordPress site over the REST API. Or you could completely replace what you know as the WordPress dashboard.
Basically, your WordPress data and content is no longer constrained. The API lets your WordPress site interact with websites or software written in any programming language.
Think about that for a second…
It’s pretty dang powerful! While you won’t ever work directly with the REST API yourself, you will benefit from it in all types of ways.
Developers will be able to create awesome web apps that are based on WordPress. WordPress will be able to truly go mobile with native apps. All kinds of improvements will be possible!
I sound like an evangelist, don’t I?
Ok, I’ll stop with the proselytizing and get into a few concrete examples of how this benefits you, the non-developer.
You Can Get WordPress Themes Written in AngularJS, ReactJS + More
For example, take WordPress REST API-based WordPress themes like Wallace or Scribe. Play around with the demos. Try clicking on some blog posts…
Currently, though, the transition is not seamless. For example, Wallace doesn’t support all WordPress functionality yet. As of December 2016, all it supported was regular WordPress posts.
You Can Build Truly Native Mobile Apps
Another thing that the WordPress REST API opens up is the ability for developers to build more feature-rich native mobile apps. Again, you won’t ever be doing this directly, but you will be able to benefit from it.
As far as I know, no one has yet turned this into an easy-to-use package for average WordPress users. But I look forward to seeing where this goes as the REST API gains momentum.
Developers Can Completely Redesign the WordPress Backend
Finally, the REST API opens up the door for developers to create 100% custom backends to manage your WordPress site. You can already see this with the Calypso interface at WordPress.com.
But this ability is not limited to Automattic. Any developer could do something similar and create a completely new way of interacting with WordPress.
Again, this is still in its infancy, so there aren’t any really cool examples yet beyond Calypso. But the important thing is this:
The door is now open.
Wrapping Things Up
But like I said, the important thing is that the door is open. Matt Mullenweg and the rest of the team committed to the REST API.
So as WordPress and the REST API continue to advance and mature, we will start seeing these new and interesting uses more and more.
If you want to see how the REST API is shaping WordPress right now, you can check out the aforementioned REST API examples like:
And if you want an even bigger list (though it’s a bit out of date), you can check out this post at WordPress.org.
Now over to you – if you’re a WordPress developer, I’d love if you shared your thoughts on the REST API in the comments. As a non-dev, there’s only so far I can take this before I’m out of my element.