Creating a WordPress REST API with Apigility


restful-wp

If you haven’t heard of it, Apigility is a great piece of software developed by the folks over at Zend. It provides a simple GUI for generating the files and base classes needed for a fully functional REST API.

Unfortunately, documentation for Apigility is still on the lighter side due to the software only being out for a year or so, so I decided to create a test project before jumping into an upcoming API project that I’m working on.

Just by exploring some of the basic features and functionality of Apigility, I ended up creating an entire WordPress REST API, complete with some pretty cool features including child routes and optional basic auth/oAuth authentication. I don’t expect this to be used in production or for any real projects, but I put it up on GitHub for anyone interested.

I figure this may be helpful to anyone looking to integrate Apigility with a WordPress install, or maybe to the folks hard at work creating the real WordPress REST API due to be merged in core, if they want to see how a larger framework does the same tasks. Let me know what you think!

 

2 comments


  1. Hi Matt, any reason why you choose Apigility over WP Rest API? I’m currently learning how to implement a REST application in WordPress.

    • Hi Chan,

      I can’t say I recommend Apigility over the WP REST API for most WordPress applications. The WP REST API will be standardized, and a lot more extensible by plugin developers. With Apigility, extending it means creating a fork of the project and updating all the config, etc.

      I can see Apigility coming in handy for larger projects that are already using Zend Framework, possibly ones that should be independent of WordPress. In my case I’d already been using ZF, so decided to give Apigility a shot.

Leave a Reply

Your email address will not be published. Required fields are marked *

*