Developing a WordPress REST API App: Getting Started

This article on developing a WordPress REST API app was originally published by Torque Magazine, and is reproduced here with permission.

Excitement over the WordPress REST API has been building for what seems like an eternity, but we’re still pretty much at the starting gate in terms of what it’s actually going to mean for site owners and developers once it finally lands.

Though I’ve written extensively about the potential implications of the REST API, I’ve been holding back on actually diving in and getting my hands dirty to date. With the REST API finally taxiing on the runway, now seemed a great time to grasp that nettle and really start digging into detail.

Over the course of this series, I’ll be taking the new hotness for a spin by putting together a simple JavaScript app that uses the REST API to power its content. It promises to be an intense learning experience, but one that will hopefully serve others who are coming from a non-technical background as well.

A Brief Note on My Background

Though WordPress has long been a passion of mine, I’m a writer and entrepreneur by trade. I can’t pretend to be coming at this project from any type of serious development background. “Knows just about enough to be dangerous” would be how I’d charitably classify my coding experience to date.

So, this series won’t be quite the deep dive you might expect from a theming professional such as Jack Lenox, or a senior web developer such as Ramsay Lanier. It should also be no great surprise that I’m not approaching this from the point of view of an established top-tier digital agency looking to kick the tires of the latest technology.

Major agencies such as Modern Tribe are already working with the REST API

Nope, this series will be much more along the lines of an average WordPress user looking to get to grips with the next generation of the platform via a practical, exploratory project.

Hopefully that’s an approach that will also resonate with a significant percentage of other site owners out there. Put it this way – if your eyes instantly start to glaze over at the introductions of other (admittedly excellent) tutorials such as the one below, this is the series for you:

In the following weeks, through a series of articles, I’ll explain how I’m using Node.js and Express on the backend with a GraphQL server hooked up to a MYSQL WordPress database that uses Apollo to fetch data and pipe it into React components. Don’t worry, I’ll still be using the tried and true WordPress admin interface.

With those caveats out of the way, let’s briefly recap why now is a great time to be really rolling up your sleeves and using the REST API in earnest.

Why Now Is the Time to Embrace the REST API

The launch of Calypso and Matt Mullenweg’s State of the Word address back in late 2015 made it crystal clear which way the wind is blowing in the world of WordPress at large. To put it in a nutshell, the REST API is going to be at the centre of the next stage of the platform’s future, and developers are going to have to get on board with JavaScript sooner rather than later.

The arrival of Calypso points the way to the future of WordPress

We’ve already seen entire conferences devoted to exploring the implications of the REST API, and increasingly large real-world projects basing themselves around it, despite its late arrival. From Microsoft to the New York Times, blue-chip companies worldwide are chomping at the bit to really explore its power.

If you’re a theme or plugin developer, you can rest assured that the vast majority of your competition are already, at the very least, actively researching the topic. If you’re a site owner, you can expect the next five years or more of your site’s development to be significantly defined by the possibilities that the REST API opens up. No matter what way you look at it, now is the time to get on board this particular train.

The post Developing a WordPress REST API App: Getting Started appeared first on SitePoint.

Powered by WPeMatico