Stuff API
The Stuff API is an example I created for a presentation on Hypermedia APIs I gave at SAPO Codebits 2012:
REST: You're doing it wrong.
It's a really basic Todo list API that uses the Collection+JSON media type. It's currently only holds Todo items in memory, no persistence. Oh, and there's no authentication, only one giant Todo list for everybody :)
What it currently allows is:
- Listing of 3 different types of lists (Inbox, Today, Next)
- Creating a new Todo item in the corresponding list
- Moving a Todo item from one list to another
I actually deployed this service on Heroku which you can find at: http://stuff-api.herokuapp.com
Go ahead and try navigate this Hypermedia API:
curl -v http://stuff-api.herokuapp.com
Notes on implementation
This was built with Ruby using the Padrino framework.
The code was Behaviour Driven Developed using RSpec for unit tests and RSpec-Given for the acceptance (feature) tests.
It's not the most exemplary code, there's a lot of things that can be done better.
I also decided to try out some of the ideas mentioned in the talk The Clean Architecture by Robert Martin (aka Uncle Bob).
Sources
These are some of the sources I used during the presentation and which can act as a starting point for those who would like to learn more about Hypermedia APIs.
Books:
- Steve Klabnik Designing Hypermedia APIs
- Mike Amundsen: Building Hypermedia APIs with HTML5 and Node
- Roy T. Fielding: Architectural Styles and the Design of Network-based Software Architectures
- Mike Amundsen at QCon
Presentations:
Blog posts:
- If REST was...
- Hypermedia Benefits for M2M Communication
- Practical Hypermedia for our post ORM world
- REST APIs must be hypertext-driven
- Gustaf Nilsson Kotte: Combining HTML Hypermedia APIs and Adaptive Web Design
- Björn Rochel: My Pain With a Non Hypermedia HTTP API
- Jan Kronquist and Mads Enevoldsen: Why hypermedia APIs?
- Collection+JSON