/stuff_api

Really simple Hypermedia API example used for a Codebits 2012 presentation

Primary LanguageRuby

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:

Presentations:

Blog posts: