There is no denying that WordPress has an absolutely massive developer community, but the fact remains that the vast majority of WordPress users are not developers. This means that while developers, the ones who actually build WordPress itself as well as WordPress themes, plugins, and more are far better equipped to understand the evolution of WordPress and how its continued advancement will affect the whole WordPress ecosphere in the future.
I like to think that one of the primary purposes of a blog like this one is to help bridge the “understanding gap” that exists between groups like developers, power users, and regular users–at least in terms of broad stroke principles, ideas, and innovations. A good example being, the new WordPress JSON REST API and what its addition to core means for everyone no matter where they fall on the technical spectrum of WordPress users.
Over the last year or so there has been a lot of buzz about this new addition to WordPress and developers, on the whole, seem pretty excited about it. I believe for good reason, but what I don’t want is for everyone else to be left out of the fun. Or, for that matter, the brainstorming for how best it can be put to use.
That’s why in this post I’d like to walk you through the basic ideas behind the WordPress JSON REST API technology and describe what some developers are already doing with it. I will also explain what else is possible with it and hopefully inspire some of you to use it in still more interesting, unexplored ways.
To get started, let’s clarify some key terms.
What Is An API?
An API or Application Programming Interface is a software intermediary that allows programs to interact with each other and share data in limited, clearly defined ways.
A few good examples of APIs in action would be:
1. Anytime an app uses Google Maps to display its location information.
2. A mobile or desktop twitter client.
3. A game/service that integrates Facebook features such as login, messaging, etc.
In these instances, and all others like them, the APIs “expose” certain internal functions of the primary applications so that outside developers can use them in their own applications or websites. In these examples, app developers have been given the ability to tap into the powerful features (and/or content) of major web services so that they can build on top of them and/or integrate key content and features into their own products. But again, only in limited, clearly defined ways. This allows a form of open collaboration to walk hand in hand with security.
What Is A REST API?
REST stands for REpresentational State Transfer. It is an architectural style of building APIs; not a code language or description of its function. A REST API is designed to provide a lightweight form of communication (less bandwidth) between producer (ex: Twitter) and consumer (ex: Twitter client), making it a great solution for high volume web services like Google Apps, Facebook, Twitter, and now WordPress.
What Is The WordPress JSON REST API (WP API) & How Does It Work?
JSON, which stands for JavaScript Object Notation, is a lightweight data-interchange format based on a subset of the JavaScript code language. It’s easy for humans to read and write and easy for machines to parse and generate. Which also makes it a great fit for creating REST APIs–such as the new WordPress JSON REST API or WP API as it has been named.
JSON is the notation, REST is the architectural style, and API is the interface they make up. When you put them all together you get a tool that developers can use to easily share data from their WordPress website(s) to other websites or applications.
More specifically, the WP API allows you to take CRUD actions on WordPress content. Which means Create, Read, Update, and Delete the following content types:
- Posts
- Pages
- Custom Post Types
- Media
- Comments
- Taxonomies
- Users
- Or any other type of content you can extend it for…
To get a better idea of why someone might want to do that in the first place, it helps to look at some use cases that show the benefits of these capabilities.
How Has the WP API Been Used Already?
With the WP API part of core and available to all WordPress users, the value associated with using it in innovative ways has increased exponentially. So far though, from what I’ve personally seen and read, there are certain obvious use cases that seem to be dominating at the moment.
For instance, you can use the WP API to improve just about any existing WordPress functionality that is JavaScript based, such as:
- backbone.js thems or plugins
- populating infinite scrolls
- form validation/submission
- front-end content editing
You can also:
- display content from another site within a multisite network
- display content from a separate WordPress site
- create or update content on a separate WordPress site or another site within a multisite network
These are all extremely valuable use cases that both solve existing issues and add new creative possibilities. However, what I’m most excited to see happening in the future are some of the potential use cases below.
What Are Some Other Potential Use Cases for the WP API?
For me, one of the coolest aspects of the WP API is that it allows you to break your content free from WordPress completely. Giving WordPress users an unprecedented amount of control over how their content is experienced.
There are a few ways one might choose to do this:
Displaying and managing your content within a mobile/desktop application (that is not the official WordPress App).
For me, this one is huge. It opens up a ton of possibilities for content creators and consumers alike. Content creators might begin to see a new and better crop of mobile/desktop blogging clients that allow them to create blog posts and more in unique environments that could never be built in the backend of WordPress itself. Likewise, there could be whole new content experiences built on the web or mobile apps using programs that function completely differently than WordPress but that get its content from a WordPress site.
Integrating your content with other application platforms.
There may be application platforms that are not built on PHP or any code language used in WordPress that nevertheless are able to seamlessly interact with your content. I could see some sort of aggregation tool that allows people to quickly and easily connect their blog and add content via tags or categories. Or something completely different! Literally the only limit is how you can think to creatively manipulate the wide ranging CRUD actions we talked about above.
Integrating other application platforms with your WordPress site.
This one is basically the inverse of the last use case. It’s important to point out on its own though nonetheless. This could allow you to have a very wide array of content sources all feeding into one WordPress site and then displayed just the way you want it.
What Does The WP API Mean for the Future of WordPress?
In a nutshell, what the WP API means for the future of WordPress is that it is one solid step closer to becoming a fully fledged application platform. How we put it to use will be one of many key determining factors in how quickly and in what fashion that becomes a reality. Personally though, I’m not worried about whether or not WordPress is classified as one thing or the other, I’m just excited about new possibilities.
For instance, I would love to have some of my favorite writing, video editing, and graphics programs able to publish directly into WordPress. I can imagine a dozen amazing things you could do–from theming to storytelling to “simple” article publishing–that this new API makes possible. Now we just have to work together as a community to build it all!
Recommended WP API Resources
If you’re interested in learning more about the WP API and what you might be able to do with it, I would recommend taking a look at the following resources:
In Conclusion
WordPress, as always, is growing and changing to continue to meet the demands of its community. Adding WP API to core is one of the biggest and most exciting ways it has done this in quite some time. I know I am personally very excited to see what others decide to do with it and I’d love to find groups to collaborate on my own ideas with. What about you though? Are you excited about the WP API? Do you at least feel like you understand it now? Please take a minute or two to share your thoughts with the whole community in the comments section below.
Article Thumbnail via Imagentle // shutterstock.com