sebinsua.com

email / twitter / linkedin / github / hn / inspiration

January 1, 2012 at 9:32pm
Home

RESTful Web Services correctly inherit and use HTTP as their interface

There’s been a lot of buzz on RESTful Web Services [1] and yet there are still far too many developers that believe they may implement it by simply using a Rest class provided by their favourite framework.

I wonder if this has been helped by the obtuse or long-winded articles that are out there on the web and so here is my attempt at explaining the concept as concisely as possible:

Building a RESTful web service requires that you (a) make your API stateless to help cacheability. And also requires that you stop building the same concepts that already exist in HTTP as part of your API and instead build a uniform API [2] that inherits the HTTP Interface [3] by (b) treating URLs as resources, (c) implementing CRUD using the HTTP methods POST, GET, PUT, and DELETE; and additionally using POST for operations with side-effects such as financial transactions, (d) using the HTTP response codes and header data correctly, and by (e) identifying and interconnecting resources by URIs in the responses, hence being hypertext-driven (HATEOAS).


[1] http://roy.gbiv.com/untangled/tag/rest

[2] http://news.ycombinator.com/item?id=2796371

[3] http://www.ietf.org/rfc/rfc2616.txt

Notes

  1. sharonx21 reblogged this from sebinsua
  2. sebinsua posted this