What's New in "RESTful Web APIs"
With the beta closed I think it's a good time to go into a little detail about the structure of the book. My guiding principle was to write a book that will be as useful now as RESTful Web Services was in 2007. Like RWS, RESTful Web APIs has a main storyline that takes up most of the book. My inspiration for the main storyline were a few books that followed RWS, notably REST in Practice and Mike's Building Hypermedia APIs with HTML5 and Node.
RWS focused on the HTTP notion of a "resource", and despite the copious client-side code, this put the conceptual focus clearly on the server side, where the resource implementations live. RWA focuses on representations, and thus on hypermedia, on the interaction between client and server, which is where REST lives. The stuff you remember from RWS is still here, albeit rewritten in a pedagogically superior way. Web APIs work on the same principles as the Web, here's how HTTP works, here's what the Fielding constraints do, and so on. But the focus is always on the interaction, on the client and server manipulating each others' state by sending messages back and forth.
We've also benefited from a lot of tech work done by others. The IANA registry of link relations showed that state transitions don't have to be tied to a media type. The RFC that established that registry also showed how to define custom state transitions (extension relation types) without defining yet another media type to hold them.
Insights like these inform the new parts of RWA's main storyline. What makes your API different from every other RESTful API in existence? That's the only part you really need to buckle down and design. Everything else you can reuse, or at least copy.
In particular, you shouldn't have to design a custom media type. Your API probably isn't that different from other APIs, and a ton of hypermedia formats and protocols have been invented since 2007. We cover a few of the most promising ones in the book's main storyline. We cover even more of them afterwards, mostly in the big "Hypermedia Zoo" chapter. Here's the book-wide list:
Maze+XML
Collection+JSON
AtomPub
OpenSearch
HTML
HAL
Siren
JSON-LD
The HTTP headers Link, Link-Template, Location, and Content-Location
URL lists
JSON Home Documents
Problem detail documents
Hydra
OData
WADL
Web Intents
XLink
XForms
SVG
VoiceXML
GeoJSON (which is only a hypermedia format on a bizarre technicality!)
RDF
XRD/JRD
Web host metadata documents
WebFinger
CoRE Link Format
After the main storyline and the hypermedia zoo, RWA continues the RWS tradition of giving an API-centric view of the HTTP standard. We have a "crash course in advanced HTTP" chapter, some of which is an update of Chapter 8 from RWS. (Look-before-you-leap requests never caught on, but I still feel like I have to describe them in RWA because I have no other source to refer you to!) Appendix A is an updated version of Appendix B from RWS, with the addition of these exciting new status codes:
308 ("Permanent Redirect")
428 ("Precondition Required")
429 ("Too Many Requests")
431 ("Request Header Fields Too Large")
451 ("Unavailable For Legal Reasons")
511 ("Network Authentication Required")
Appendix B is an update of appendix C from RWS, with these API-licious new HTTP headers:
Link and Link-Template
Prefer and Preference-Applied
The amount of reused material in RWA is really small, because the main storyline is completely rewritten for 2013. And I haven't even mentioned our coverage of profiles, partly because I can't yet think of a way to talk about profiles at less length than what we say in the book.
Leonard Richardson's Blog
- Leonard Richardson's profile
- 43 followers
