Learn about the new WP-API

The WP-API is revolutionizing the way we use WordPress. In this presentation I gave at the first-ever WordCamp San Antonio, I introduce you briefly to the WP-API and show you how and why it will affect everyone who uses WordPress.

WordPress is advancing rAPIdly

Today we are going to be talking about some really big changes that are happening to WordPress with the creation of the WP-API and how and why I think they affect everyone who uses WordPress. I want to start by making two really important points that I think are universal:

  1. The Internet and how we interact with it changes EVERYDAY. We as individuals have to find a way to keep up with it by constantly staying on top of new technologies and adapting so that we aren’t left behind.

This isn’t something meant only for developers. If you own a business and have a business website that somehow brings in revenue for your company then you need to be aware of what is going on in web technology so that you can stay one step ahead of your competitors. As for designers and developers like me, in order to continue to grow and advance in our careers we have to stay relevant in our field otherwise we are going to get stepped over and left behind.

wp-api-wordpress-presentation.004

  1. Investing is risky but when it is done properly and with insight you can really make it big. You have to watch the trends
and most of the time new technology is going to be a safe bet for revenue potential.

When you see that something is on the cusp of happening and you have a strong feeling that whatever (it) happens to be is going to be the future…you should really jump on board!

wp-api-wordpress-presentation.005

I was really inspired recently while sitting in on Matt Mullenweg’s State of the Word speech at the 2014 San Francisco WordCamp.

wp-api-wordpress-presentation.006

He briefly touched on the new WP-API and in a few words opened my eyes to a new world of WordPress. I would like to share that epiphany with you today.

wp-api-wordpress-presentation.007

I would like to point out that this presentation isn’t going to be a full-blown, how-to tutorial on the WP-API. Frankly I’m not an expert on the matter and there have been some really great people, who happen to be the experts on the matter, who have already given some really great info at other WordCamps around the world. So I am going to provide you guys with a few resources that I think you should check out if, after my presentation, you are as inspired as I was.

The official WP-API website

WP Tavern article interviewing Ryan McCue

WordCamp presentation by Rachel Baker

WP Engine article on Torque

I want to paint a very clear picture for you guys of how much WordPress is growing each and every day. As Brandon Kraft mentioned in his WordCamp San Antonio keynote, 23% of websites are currently on WordPress. You can’t ignore some of these stats:

wp-api-wordpress-presentation.008

Now picture those stats in your head and imagine if every single website that is built on WordPress now has it’s own API. Some of you are probably saying, “Well that’s pretty cool but what the heck is an API?”.

wp-api-wordpress-presentation.009

wp-api-wordpress-presentation.010

Think of an API as an HDMI port on your TV. This port allows you to connect to the TV and stream high definition information into the TV, as well as, allowing the TV to stream sound out of the TV and into something like a surround sound system. An API allows people the ability to interact and manipulate the information that you share on your website and use it to create new / different things. In turn, the WP-API allows YOU to interact with over 23% of the websites on the internet. That is crazy right?

wp-api-wordpress-presentation.011

Let’s look at a few examples of APIs currently in the wild. You have probably used a few of these platforms a time or two. All of these, and many more, are built on an API so that they can be extendable and can change and evolve over time.

wp-api-wordpress-presentation.012

This chart shows a timeline of the history of the API. You can see that in 2000 we had ebay, then Amazon, and Sales Force. By 2005 we had Yahoo, Flickr, Google, and Skype. After that you can see that things just started growing exponentially. So much so that they didn’t even bother counting after 2011. You can see that in the past couple years there is an overall perception that we should … API all the things!

wp-api-wordpress-presentation.013

wp-api-wordpress-presentation.014

Let’s explore the Twitter API. Here on the screen are three examples of Twitter Apps that you can download on Apple and Android devices. If you are familiar with the official Twitter app you know that these look very different. None of these apps were built by Twitter. They were built by other individuals who used the Twitter API to connect into Twitter and use all the same functionality and pull out all the DATA, and build a completely separate app with it. Data is the keyword here and we will discuss this more later. Then they designed these apps to appeal to different groups of people and some of these apps are actually not free. So these individuals are making money off the extensibility of the Twitter API.

wp-api-wordpress-presentation.015

This is a comparison of the official Twitter app and one called Falcon Pro.

wp-api-wordpress-presentation.016

You can see that all of the same information and functionality that comes with the official app is in this app as well but this one is designed completely different. This version has a dark background and uses very clean, bold typography. This app would appeal to a very different audience and can entice people to purchase it over the free version.

Now that we have a better understanding of what an API is, let’s look at some of the benefits of WordPress having one. I truly believe that there are benefits that we don’t even know exist yet and I am excited to see those come to life. Right now I think there are two apparent benefits to having the WP-API:

wp-api-wordpress-presentation.017

The first benefit would allow developers to create unique experiences, one of them that comes to mind would be custom applications. On top of that, plugins and themes would be able to access data on your site and more efficiently display the content without having to reload the entire page. Sections of your site could be updated live or even by a user interacting with the site.

wp-api-wordpress-presentation.018

Above is an example of an actual site built with Node.js. It utilizes the WP-API to pull over the data from your WordPress installation and display it within your Node.js framework.

This concept extends to mobile application development as well.

wp-api-wordpress-presentation.019

I’m sure you caught that I said the web application was built on Node.js. If you know anything about WordPress, you know that it is built with php, but with the ability to pull out the data from your WordPress site you can build an application using pretty much any coding language. The benefit, in this case, of using Node.js is that if you navigate around on this website, and I encourage all of you to go play around with it, the entire page doesn’t refresh…the new content is pulled out of your WP website and thru the WP-API and fills in the page. Can you imagine how speedy these pages can load without having to refresh everything on the page.

The best part about it is that your clients, the people who pay you to build their applications, will be able to control all of this data themselves still through the WordPress admin interface or dashboard as we call it.

Imagine being able to build a huge application with dozens of custom content types, all with custom data associated to this content. You can grab it, update it, do whatever you want to with it. This is because the WP-API uses JSON. JSON is a data format based on Javascript’s representation of objects. It’s widely used because most programming languages have an easy way to convert their standard data structures into JSON, and vice versa.

wp-api-wordpress-presentation.020

To give you a quick comparison. Typically mobile apps use the XML-RPC API, but on average 40% of the developers code that is written to make the app is simply written to understand the XML properly, whereas iOS and Android natively support JSON.

wp-api-wordpress-presentation.021

The second benefit I want to discuss is Extensibility

Extensibility in this case just means that we can pull data from basically any WordPress site and do something with it. The best way to explain this is with a few examples:

wp-api-wordpress-presentation.022

wp-api-wordpress-presentation.023

Now that we know some of the benefits of the API, and how they affect pretty much everyone, lets quickly look at how this is accomplished.

wp-api-wordpress-presentation.024

These request methods should look familiar to you if you built any type of front-end forms. We use the GET and POST method to deliver the information entered into the form to the place that it needs to end up.

  • The GET method requests info, in this case it pulls out JSON data and shows a list of team members
  • You can also use the GET method to pull out a single bit of information, in this case only one team member
  • Then we have the POST method which creates data, in this case creates a team member
  • The PUT method allows you to edit information
  • While the DELETE method removes information

For your peace of mind:

The later three request types require authentication in order to perform those requests. Most GET requests do not require authentication, this allows you to display content via the API on the front of your site, or in an external app without a user needing to log in. So you don’t have to worry about someone editing or deleting the content inside your site by connecting to this new API, those features are protected just like your login screen to your WP site is password protected.

wp-api-wordpress-presentation.025

To conclude, I just want to mention something that Matt Mullenweg quickly spoke about in his recent speech in San Fran. He said something along the lines of “Imagine what people will be able to create once they can build out their own custom WordPress dashboards, I wonder what those would look like”. So I don’t think that the WP-API currently has the capabilities to change the look and location of the WP dashboard but imagine once this does get included how your dashboard could look.

It could look something like this

wp-api-wordpress-presentation.026

…or this…

wp-api-wordpress-presentation.027

…or even like this…

wp-api-wordpress-presentation.028

What I want you to really take away from this presentation is that this WP-API is opening doors for each and every person using WordPress. If you happen to be a business owner, think about how this API can allow your WorPress site to surpass your competition. If you know that this type of technology is available before it really starts to catch on with everyone else, then you can get that upper-hand by implementing it now. As for the designers and developer who build with WordPress, start exploring web applications and some of the coding languages that are used to build them. We need to keep evolving the way we build websites, otherwise your livelihood could be on the line. You could build a business right now off of developing new and improved user experiences with the WP-API that could make you a lot of money and set your company up to be an authority in this new field. If anything…start playing with the WP-API so that it can continue to improve. Without people talking about it and using it, we don’t even know what could be in store for the future.

wp-api-wordpress-presentation.029

We are on the cusp of the WP-API right now! Getting involved in it now will allow us to benefit MORE because, as with most things, it takes a while for people to change their way of doing things. In a few years when they realize the power and potential, they will just be jumping on our bandwagon! Go forth and WP-API.

wp-api-wordpress-presentation.030

Connect with Wayne McWilliams

wp-api-wordpress-presentation.031