News for hackers. Stuff that matters.
Re:How Not to write a "REST" API by masklinn on Wednesday February 01, 2012 @11:58AM (#3538789)
* Not hypertext driven, all URL patterns are hardcoded and must be rebuilt. The one mandate of REST APIs is that they be hypertext-driven, this is a deadly sin: http://roy.gbiv.com/untangled/2008/rest-apis-must-be-hyperte...

- Linked to that, a significant part of the documentation is about URLs to hit instead of being about document types

* Misuse of HTTP verbs, a lack of use (by going through POST for everything) would be bad enough but they go through GET which should be 1. safe (should not alter the server's visible state) and 2. idempotent (should be callable n times with the same parameters returning the same result, as long as the server's state was not changed). This API deletes things through GET.

* Lack of use of HTTP headers, instead of using the Accept header the client has to use an informally defined query parameter

* Lack of descriptive content types (linked to previous point)

* Complete absence of use of HTTP status codes (standard or custom), the API returns a status of 200 in all cases

This is pure and simple (and terrible, since it's over GET) RPC tunneled through HTTP.

There are no comments on this comment yet.