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.

V2.WP-API.ORG

 

What is JSON

JSON (JavaScript Object Notation) is a lightweight data-interchange format. It is easy for humans to read and write. It is easy for machines to parse and generate.

JSON.ORG

 

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.

Website
This is torquemag.io website. What you see when you access it from a web browser.
JSON
This is the JSON data returned when you visit torquemag.io/wp-json/. It's the same as visiting the site but without the theme. You get the raw post data in JSON format.
Mobile App
This is the torquemag.io iOS app. The app retrieves the post data from the JSON API.

 

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.

wordpress.org/plugins/rest-api

 

Core Endpoints:

  • Posts
  • Post Revisions
  • Pages
  • Media
  • Post Types
  • Post Statuses
  • Comments
  • Taxonomies
  • Categories
  • Tags
  • Users

The core endpoints are accessed in a URL structure like below. Read more about the endpoints in the WP-API documentation.

 

/wp-json/wp/v2/posts
/wp-json/wp/v2/pages
/wp-json/wp/v2/media

 

Custom Endpoints:

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.

v2.wp-api.org/extending/adding

 

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
  • WordPressOS

 

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.

flipkart.com           washingtonpost.com/pwa

pwa

 

 

WordPressOS

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.

wpos

 

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.

 

Frameworks

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.

 

  • Angularjs
  • Reactjs
  • Ionic Framework
  • Emberjs
  • Nativescript
  • Electron

 

 

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.

 

iotlist.com
Internet of Things List is a web directory of web connected hardware. We can now build hardware to interact with WordPress.
Wirecutter.com
Wirecutter is a product review site. Wirecutter uses the API for product search. Disconnecting the search from the display allows the server to be optimized for data only.
nytimes.com
The New York Times uses the API to power their live blogging among other things. Posting to and from the admin is too slow and clunky for a live blog.
poststatus.com
Post Status uses the API with a custom endpoint to provide their partner ads. Data displayed can be customized to the user browsing the site. Instead of a related post to the current post it could be posts related what the users previously viewed.
tri.be
Modern Tribes company website is a full Reactjs front end. The sites animations a so buttery smooth I wanted to slice a loaf of bread and rub Modern Tribe all over it. Lazy loading content from API makes the user experience enjoyable.
mindingkids.co.uk
Minding Kids is a site for day care businesses. They added a web app to monetize. The app uses API data. Saas businesses can use the API to leverage web apps.
rooomy.com
Rooomy is a site for real estate agents to digitally stage home furnishings. The site uses cached API data so when you revisit something it doesn't have to hit the server again.
adayofrest.hm
A Day Of Rest is a conference on WP-API. The conference site is using the API to display all its content. You can even see the API requests at the bottom of the page.
Calypso: WordPress.com
WordPress.com unveiled a new Reactjs powered admin for their saas. By using Reacts they could utilize the same code base to ship a desktop application. When you create a API powered web app over a website you can use code base on other platforms.
happytables.com
Happy Tables completely tossed out the often confusing and overwhelming WordPress admin. They built a UI that made more sense to their users, restaurant owners. The API allows this high level of customization by separating data from presentation.

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?