We’ve watched as WordPress has matured from a simple yet bold venture away from the old era of web logging, into a powerful, multi use tool that powers over 25% of all existing websites. I you haven’t, well you can take a look at the history of WordPress here.
As of WordPress 4.4, released on December 7th, the WordPress REST API has become part of WordPress core, bringing with it all kinds of exciting implications for the future of WordPress.
In this article, we’ll talk about what the WordPress API is, what it means for the WordPress community on a macro scale, and how even relatively non-technical WordPress users will be able to benefit from these advancements in the platform.
Although I consider myself a proficient web developer, much of my knowledge and use of the WordPress platform is decidedly non-technical, dealing more with the implementation of themes and the optimization of accessibility, page load, and SEO. However, the WordPress REST API goes beyond the realm of plugin development and extension of the WordPress base, and is actually quite useful and powerful even for casual WordPress users with only basic knowledge of the platform. Before I get into what makes the newest edition to the WordPress platform so great, I’ll first provide a bit of an overview on what the REST API actually is.
What is the WordPress REST API?
As WordPress has matured as a framework, more and more robust and powerful features have been added to enhance its overall capabilities. The newest of these is the WordPress REST API, which allows developers to easily read and write information to and from a WordPress implementation without necessarily having to deal with any of the WordPress interface itself.
Breaking it down into even smaller parts, an API (Application Programing Interface) allows developers to interact with an application. A REST (Representational State Transfer) API is a simple web architecture that works over HTTP, opposed to more complex architectures that use different protocols that aren’t as common. This is a pretty basic explaination of the REST architecture, more can be read about it here.
To illustrate a basic example, developers can use a GET request, like /wp-json/wp/posts and the site’s posts will be returned in a JSON (JavaScript Object Notation) format. This adds so much power to the basic WordPress platform because developers can create WordPress powered web applications without necessarily dealing directly with any of the traditional WordPress backend, among other cool possibilities.
The fact that the WordPress REST API uses JSON to handle its data is pretty awesome. JSON is a modern data format that is both widely used and human friendly. This means that this new API has immediate compatibility with a huge number of third party applications that already use JSON. Also, since JSON is already so popular in the development community, the WordPress REST API is made even more accessible by their use of the format.
If you’re new to JSON, a good introduction can be had over at the JSON Website or at Copter Labs.
What makes the API so great?
These tools open up the possibility for a whole new world of WordPress applications. Being able to grab information from a WordPress site away from the traditional WordPress interface means that the platform can be used in increasingly awesome ways.
A few early examples of the WordPress REST API in use are already out in the real world. WordPress.com already uses their own API for a custom admin interface for hosted WordPress.com sites. Other examples like Bloomberg Politics and Mashable use a similar, proprietary API to manage a WordPress front end and a custom CMS back end. These could easily be replaced with the WordPress REST API, and we may start seeing a huge amount of differentiation between even small WordPress sites as the ease of customization spreads via the new API.
Another incredible benefit of the WordPress REST API is the implication it has for the use of languages other than PHP to power website back ends. Although PHP has many drawbacks, it is still uses for over 80% of modern websites, making it by far the most popular back end technology. However, other languages like Go, Python, Ruby, and even to some extent JavaScript (in the form of Node.js) have significant advantages over PHP in terms of speed, extendability, and support. With the new API, these languages can easily be used without any compatibility issues to create native, WordPress powered applications.
Additionally, the WordPress REST API allows for the possibility of true WordPress powered mobile applications. Before the new API, the WordPress platform arguably did (does) a great job of providing wide mobile device support, through the use of responsive theming. However, viewing these sites on your phone’s browser doesn’t constitute a true native mobile experience. With the REST API, however, developers will be able to treat any WordPress site like any other server, meaning WordPress now has the possibility to serve as the backend for any native mobile application. Since native applications are almost always superior to even the best mobile optimized web experience, this means that WordPress has taken some big steps towards becoming a big player in the mobile application sphere.
Who will benefit?
The benefits to developers may be apparent, but how does the end user benefit? I think the ability for WordPress to be used as a backend for all types of mobile applications is the single most powerful possibility within the WordPress REST API. I believe we’re going to see an explosion of niche content mobile apps that are powered by their WordPress site counterparts. This means that users who do the majority of their internet activities on a mobile device will have even more options for accessing the content they want via a native interface. It also gives developers a much needed option to cater to these types of users, without the difficulties that come with building a traditional web site or application that has to adapt to the ever-changing mobile landscape. At StatenWeb we can help with any development or our friends at UnderstandingData can help with data analysis.
Conclusion
Hopefully this article has piqued your interest on the WordPress REST API and what it means for the future of the WordPress platform. Even if you don’t consider yourself a hardcore WordPress developer, it would be hard to argue that these changes won’t affect you in some way.
It’s also important to note that the current WordPress REST API that is living in WordPress core isn’t a finished platform. As it matures, it will be interesting to see what additions are made and how it will affect the wider WordPress ecosystem.
We’d love to hear your experiences with the WordPress REST API and what you think of what it means for future WordPress projects. Leave your thoughts in the comments below.