API Documentation with IODocs
I write a lot of APIs, and I also preach that your API isn't finished until it has excellent documentation. Which is great, but that means I therefore have to lead by example and document my APIs. Enter iodocs from the talented folks at Mashery.
Iodocs is a node.js application (which is fun for a PHP developer. Most developers write a bit of JS, but this one hasn't). You describe your API and all its methods in JSON, and then iodocs presents an interface for you to enter API keys, add parameters to each request and press the "try it!" button. This makes your API call and shows you the results on screen, which seems like a great way to demonstrate what all the various parameters do!
The setup and installation was pretty straightforward - node.js apps all have a packages.json file which states their dependencies and the npm package manager knows what to do. So you just grab the app from github and npm install and it pretty much worked. I had a problem with an older version of node.js (I had 0.8.2, when I upgraded to 0.8.9 it was all fine) but I figured it out.
I like the iodocs as a way of showing to the user what you can do with the API before they have to settle down and write some code. For example, on joind.in, you can request lists of events using various criteria, and iodocs presents form fields for that:
If you want to have a play, I deployed this to heroku (blog post coming on that too, if you like) so you're welcome to click around: http://lornajane-iodocs.herokuapp.com/joindinv2. There are descriptions of other APIs too, and I've seen a few sites using this (which is where I came across it). The big stumbling block at the moment is the lack of OAuth2 support (as both joind.in and github use this, I'd quite like it!) but the mashery devs have promised to get back to me on that so watch this space ...
(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)