Building an embeddable REST API Console

One of my latest projects is an API to access the beer inventory put online by the Utah DABC.  I’ll save the details of that project for another post, but in the meantime you can check out the code on Github.

After making some decent progress, I started to think about how best to share it with the world.  Having worked with many APIs over the course of my programming life, I realized that the ones I enjoyed the most and achieved the quickest success with had one thing in common: an interactive console.

Twitter was the first example that came to mind.  Their console is powered by Apigee, and in a rare failure of my Google-fu, I came to the conclusion that the Twitter API must also be powered by Apigee and the console feature is reserved for paying customers.  (This assumption turned out to be false.)

It then occurred to me that the WordPress.com REST API had it’s own console, and that the company responsible for it had a good track record of open sourcing their work.  I was able to find this blog post about the original console, and subsequently the Github repository with the source code of the current version.

Much of the code is tied to either the WordPress.com domain or the architecture of the API itself.  I took a “bare minimum” approach to modifying the console for my own purposes; turning the root endpoint into a configuration variable, and creating an “authentication provider” that didn’t actually authenticate.  You can see the changes I made here.

Even with a basic API, the result is beautiful: