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:
- 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.
- 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!
I was really inspired recently while sitting in on Matt Mullenweg’s State of the Word speech at the 2014 San Francisco WordCamp.
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.
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.
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:
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?”.
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?
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.
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!
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.
This is a comparison of the official Twitter app and one called Falcon Pro.
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:
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.
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.
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.
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.
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:
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.
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.
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
…or even like this…
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.
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.
Connect with Wayne McWilliams