A not-dissimilar leap is required to move from a REST-ish API to the "Glory of REST" that is Level 3, or Hypermedia REST. In the Richardson Maturity Model, the sequential levels of REST are not different kinds of REST, but rather the logical progression of API change that leads to REST. They are steps of maturity to the end state. Think child, teenager, adult.
Level 1 and 2 simply aren't REST. Only an API that is at the last level, Level 3, can be considered REST. The other levels are the logical progressions one needs to take to get to the edge of the precipice before leaping to Level 3.
REST Is About Trust
Crossing the chasm from Level 2 to 3 requires trust. The API consumer must leave application control entirely in the hands of the API. A Level 3 REST API presents all that is needed, when it is needed, and the client merely discovers these affordances as they navigate the links. All the client has to know is where the starting point is and how to manipulate the links.A Hypermedia API is a browsable API. No longer does the client developer have to construct a URI to do everything. No longer must the client developer know how to change the state of the system with an incantation (method call), or know how to read data from another part of the system. All data, all state transitions, all are provided by the Representations of State, Transferred to the client.
I mean this. It really is a leap. It is unfamiliar, and frankly scary, because we have always been able to create a service-like API to do our job, and a URI template to invoke it. REST does not provide malleable services, but rather linked resources with only four verbs to manipulate them.
All That has Been, Will Be Again
Fortunately for us this is not the first time we have had a relationship-based, 4-verb architectural pattern to leap onto. Remember our old friend the database? it has a couple of interesting aspects:- Four verbs (SELECT, INSERT, UPDATE, DELETE)
- Resources (tables) that are linked together (join tables)
REST has no verbs. HTTP does, tho. So does FTP, CoAP, etc.
ReplyDeleteFine point Mike. The transport verbs translate to the API as-is. Your HTTP GET turns into my API READ.
ReplyDeleteyep. M2M systems will not use four verbs (regardless of protocol or arch-style), BTW -- only three at most: READ, WRITE, DELETE. and all three will be idempotent. HTTP's POST is a pain and will not work for M2M; esp. at substantial distance.
ReplyDeleteHmm. How do M2M bindings create anything? READ/UPDATE/DELETE all require addressable things.
ReplyDelete