When I was 13, I started to notice the other kids had nicer things than we did. You see, we were dirt poor. My mom was a single mom with 4 kids. I decided if I wanted nice things I would have to get it on my own. LIGHTBULB! We had a broken down lawnmower and I thought if I could get that mower running I could make some cash and get that Atari 2600 I desperately needed.
I tore that mower apart. My mom got home and yelled “what the hell did you do?”. I shrugged it off, not like it was going to get fixed by other means. I had no idea what I was doing but I had courage to take something and make it work for me.
WordPress is about the same age I was when I tore that mower apart. A teenager, inquisitive, hungry to expand itself. You, like I did to that mower, can take WordPress and jump head first, tear it apart, change it, to suite your own needs.
Buy that fancy new theme, tweak those 25 plus plugins you have installed, get your “lawnmower” to work. This is WordPress today.
The way people use the internet is vastly different today than when WordPress was first released. Smartphones didn’t exist. Mobile apps didn’t exists. Web technologies we use today were embryos or a pipe dream.
If WordPress were built from scratch today it probably would not even resemble what it has become. This is neither a good or bad thing. Just a fact. WordPress wasn’t built today but has grown along with the web. A solid, secure foundation for creating Websites. Used by many.
The web has grown into a plethora of API connected services consumed by a variety of devices. WordPress finally has an API to join that connected web. To release its siloed data, to build modern product and services.
WordPress is at that teenage stage where it wants to experiment, create things, learn, fail and grow. Building services on top of WP-API is a great way to build WordPress into what it would be if it WERE built today.
This post isn’t highly technical, more inspirational, somewhat hypothetical. Hopefully it will inspire you to start building the web’s future on top of WordPress’ newest API.
What Is WP-API
WP-API is a JSON REST API. A RESTful API is an application program interface (API) that uses HTTP requests to GET, PUT, POST and DELETE data.
What is JSON
One of the most applied use cases of JSON API is mobile app consumption. Torquemag.io uses WP-API to send post data to its iOS app.
torquemag.io site, JSON data and mobile app.
Where to get WP-API
If you are running WordPress 4.4 + then you already have it on your site. The API infrastructure was added in WordPress 4.4. The current core endpoints, posts, pages etc are available through a plugin.
- Post Revisions
- Post Types
- Post Statuses
The core endpoints are accessed in a URL structure like below. Read more about the endpoints in the WP-API documentation.
The best part of WP-API is it isn’t a stone. It’s many stones, you can add custom endpoints creating unlimited rest APIs. If your service isn’t about blogging then you don’t have to use the posts endpoint. Create endpoints that make sense to your product.
End Points in Core:
There’s a renewed push going on right now to try and get what is being termed “content endpoints” into WordPress core with the 4.7 release.
Helen, release lead for 4.7, has identified blockers for inclusion. Your help is needed. make.wordpress.org/core/2016/09/08/wordpress-rest-api-update
Forking The Future of WordPress
You can fork WordPress without forking WordPress! The API is like a reset for WordPress. Building on top of the API is a blank slate. Theming and admin are insignificant to what you can build.
The API is a way WordPress can control the goalpost. When asked about the future of WordPress and its threats, Brian from Post Status had this to say…
WordPress is easy to use compared to other CMSs, but is it easy to use versus social platforms or other places where people type words, share pictures, and maintain a digital footprint?
The goalposts are always moving and we have to move too.
– Brian Krogsgard poststatus.com
26+ % of all websites are WordPress
That’s huge. But will it rise as a CMS/blog? The API opens up WordPress to dominate in other markets. WordPress has barely begun to integrate itself in other internet connected markets. These are some areas that WordPress could dominate:
- Internet of things – web connected devices
- POS Systems – when you order at a restaurant from a screen
- Information Kiosks – museum type interactive displays
- Desktop Apps
- Mobile Apps
- Progressive Web Apps
Progressive Web Apps
PWAs are something you are going to here a lot about. Essentially its mobile apps like you download from app stores but with out the need to “download”. Open a browser type in the url and start using the app right away. These two are great examples of PWAs. The Washington Post is using WP-API for its App data.
Not as an OS you install to a computer but more a personal web connected operating system, a hub for your digital life. WordPress could be the connector between you and other services controlled via apps and devices, without a modern REST API this wouldn’t be possible.
WordPress is the dominant CMS on the web, it is our duty as a community to move the UX forward in relation to emerging technologies.
Listed here are some of the frameworks the WordPress community has started using to build new user experiences on the WordPress platform and WP-API. Google search, there are some WordPress specific wrappers for a few of these to get you started.
- Ionic Framework
If you can build a WordPress theme then you can build apps and services using web technologies. Most apps you get from app stores today are merely web apps inside a native wrapper. Don’t think you will have to learn completely new technology stacks. Your WordPress development knowledge can take you far.
Examples In The Wild
This slide show consists of some examples of WP-API in action. This is just a small selection of different types of usage. Some are small user experience enhancements, others are full blown applications.
WP-API will revolutionize WordPress. We are only starting to experience the possibilities. It is in our best self-sustaining interest to incorporate the API into our development best practices. Theme developers can greatly enhance the user experience creating front ends that consume JSON data. Developers can build services that supply the data.
The next few years are going to be exciting to see what we build. What will you build?