Let's face it, the term "REST" has become too popular for its own good. Like so many other hyper-successful buzzwords, REST means very different things to different developers. If you think that REST loosely translates to "JSON over HTTP", then it's time for a hypermedia intervention. In this talk, you'll learn about the core tenants of RESTful design, where the major frameworks go astray, and why it matters. We'll also discuss some of the exciting things going on in the hypermedia community, and how you can take advantage of them to build more awesome clients and servers.
8. Representational State Transfer (REST) is a
software architecture style consisting of guidelines
and best practices for creating scalable web
services. REST is a coordinated set of constraints
applied to the design of components in a distributed
hypermedia system that can lead to a more
performant and maintainable architecture.
9. Representational State Transfer (REST) is a
software architecture style consisting of guidelines
and best practices for creating scalable web
services. REST is a coordinated set of constraints
applied to the design of components in a distributed
hypermedia system that can lead to a more
performant and maintainable architecture.
10. REST is the architectural style of the internet
14. –Roy Fielding
“…if the engine of application state (and hence the
API) is not being driven by hypertext, then it cannot
be RESTful and cannot be a REST API. Period.”
24. “A REST API should be entered with no prior
knowledge beyond the initial URI (bookmark) and set
of standardized media types that are appropriate for
the intended audience (i.e., expected to be
understood by any client that might use the API)”
–Roy Fielding
27. Hypermedia Benefits
• API discoverability and documentation
• Reuse of state transition logic across clients
• Ease of client development
• More flexibility for servers to evolve
37. Questions?
❖ API Craft Google group/mailing list
❖ RESTful Web APIs (Richardson/Amundsen)
❖ Roy Fielding’s thesis/blog
❖ Hypermedia formats (HAL, Siren, Hydra, CJ, JSON-LD,
UBER, etc.)
❖ API Craft conference in Detroit (http://apicraft.org/)
Editor's Notes
Ask for questions!
Don’t be offended if I suggest that we talk about it offline. (I ramble)
http://commons.wikimedia.org/wiki/File:Roy_Fielding.jpg
Know this guy?
http://commons.wikimedia.org/wiki/File:Rembrandt_-_Moses_with_the_Ten_Commandments_-_Google_Art_Project.jpg
Fielding presented constraints/definition for REST
As usual with rules/manifestos, people didn’t quite agree
Raise your hands…
I bet everyone is right… just not the way you think
Next, I have one simple question
This was a harder question than I thought to answer
My definition before I did my homework
http://en.wikipedia.org/wiki/Representational_state_transfer
wikipedia definition of REST (no wonder I couldn’t sum it up)
Hypermedia is a requirement for REST, HTTP isn’t
Hypermedia is a core part of Fielding’s dissertation, HTTP is only mentioned indirectly
For this talk, we’re going to focus on REST over HTTP, but that’s NOT a requirement
http://roy.gbiv.com/untangled/2008/rest-apis-must-be-hypertext-driven
according to Roy, you need hypermedia
Let’s get more concrete
If Fielding is black and white about REST, Richardson’s model is shades of grey
server is pushing down resource state alongside available transitions through the system
think about google.com as an example
http://upload.wikimedia.org/wikipedia/en/0/01/Screenshot_of_Zork_running_on_Frotz_through_iTerm_2_on_Mac_OSX.png
Who’s ever played a text adventure? Wasn’t it annoying trying to guess what the game wanted you to type?
The web works in a similar way- both are basically state machines (though the web is massively distributed, lazily evaluated, etc.)
Much easier if you tell the player what they’re able to do instead of having them guess (though maybe less fun)
Without hypermedia, we agonize over URL structure. Trying to make life easier for clients?
The thing is, clients don’t care about URLs, they care about state transition/manipulation.
Lots of formats with different affordances- going to focus on CJ for this talk since it’s easy to grok, natural transition for CRUD thinking, one I’m most familiar with, etc.
sort of… not a ton of perfect examples, but it seem to be coming along
Has anyone browsed a web page? If so you’ve used a REST API. Apply the same concepts that made the web successful to your APIs and profit.