In early 2013 I started learning AngularJS, and decided to write my experience down in a blog post. I had written my first AngularJS powered WordPress theme, and life was good. Except, it wasn’t, I needed an RESTful API to really make some magic.

Living Without The API

admin-ajax all the things
I was going through my GitHub repo for my AngularJS WordPress Theme and was wondering how far it went. I wasn’t sure if I had even put my original version of the theme on GitHub, let alone before WP-API came out. And there I found my original functions.php file. The original file was all admin-ajax powered and did not return anything more than a “SUCCESS” message to AngularJS. I needed a better solution to return JSON data.

Fast forward a few commits and I had comment data coming back to my AngularJS app as JSON Data. This was still really hoaky, I was creating posts and deleting posts with nothing more than a “success” message return, and returning JSON data without filtering or sanitizing. BUT IT WORKED!

The API is born, I rejoice

A few months later I stumbled on a project by Ryan Mccue, who was working on a GSoC project. He would not update or take on PR’s for it, but it was the start of something beautiful. Then, in December 2013 I commit a new functions.php file, and it localized the /wp-json.php route so I could use the JSON REST API or WP-API as it was only called back then. This changed everything. I no longer needed admin-ajax for anything, but was now using the API 100%

Life is better with the JSON REST API, no more clunky hoaky API’s, and a revolution for Client Side Application Builds.. its an awesome project.

Give back to the WP-API by helping with the build, or just using it and giving feedback. If you want to learn how to use it, go to any WordCamp and there is bound to be 2-3 talks about it. 🙂