API Documentation with IODocs
Join the DZone community and get the full member experience.
Join For Freei 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 ...
Published at DZone with permission of Lorna Mitchell, DZone MVB. See the original article here.
Opinions expressed by DZone contributors are their own.
Trending
-
IntelliJ IDEA Switches to JetBrains YouTrack
-
How To Scan and Validate Image Uploads in Java
-
Integration Testing Tutorial: A Comprehensive Guide With Examples And Best Practices
-
HashMap Performance Improvements in Java 8
Comments