Upgrade to Pro — share decks privately, control downloads, hide ads and more …

On the Edge of Hypermedia - Midwest.IO

On the Edge of Hypermedia - Midwest.IO

Stateless.. Nouns & Verbs.. Idempotent.. HTTP Auth.. Tokens.. We’ve all heard those phrases thrown around when we talk about REST. We’ve been told our systems have to include these characteristics or they’re not RESTful. We’ve talked over and over again on how to implement them. Unfortunately, somewhere along the way, we lost the answer to “why?” What’s the point? What value do we gain by doing things the “right” way?

Keith Casey

July 15, 2014
Tweet

More Decks by Keith Casey

Other Decks in Technology

Transcript

  1. Uniform Interfaces Four Principles Identification of Resources Manipulation of Resources

    through these Representations Self-descriptive Messages Hypermedia as the engine of application state (HATEOAS)
  2. Uniform Interfaces Four Principles Identification of Resources Manipulation of Resources

    through these Representations Self-descriptive Messages Hypermedia as the engine of application state (HATEOAS)
  3. Uniform Interfaces Four Principles Identification of Resouces Manipulation of Resources

    through these Representations Self-descriptive Messages Hypermedia as the engine of application state (HATEOAS)
  4. Self Descriptive Each message should tell you: if that resource

    is cachable; how to process itself; how to request the next resource;
  5. Code on Demand (optional) A request doesn’t just retrieve a

    resource but also the code to act upon it We don’t have to know or understand the code, just how to run it Allows for flexibility, upgradability
  6. Uniform Interfaces Four Principles Identification of Resources Manipulation of Resources

    through these Representations Self-descriptive Messages Hypermedia as the engine of application state (HATEOAS)
  7. HATEOAS Clients make state transitions only through actions that are

    dynamically identified within hypermedia by the server (e.g. by hyperlinks within hypertext). Except for simple fixed entry points to the application, a client does not assume that any particular actions will be available for any particular resources beyond those described in representations previously received from the server. Source: http://en.wikipedia.org/wiki/ Representational_state_transfer#RESTful_web_services
  8. Link Relations A link relation is a descriptive attribute attached

    to a hyperlink in order to define the type of the link, or the relationship between the source and destination resources. ! Source: http://en.wikipedia.org/wiki/Link_relation
  9. {! "_class": "Collection",! "_links": {! "first": {"href": "/v1/audio"},! "item": [!

    {"href": "/v1/audio/d796f2d0eb72492bb088e0e9fcb1dfa2"},! {"href": "/v1/audio/0fc32337449a4a9d95f78a9a6cc85945"},! {"href": "/v1/audio/fc34f625a12f4e17945c3c027dbaf19e"},! {"href": "/v1/audio/5a7f16a728ea40c4b8179c1b6b1796ec"},! ],! "last": {! "href": "/v1/audio?iterator=l1b00000000000000000000000000000000h0"! },! "next": {! "href": "/v1/audio?iterator=l1adabb46fdba39418390f8c9b2b04a4631h1395421325416"! },! "self": {"href": "/v1/audio"}! },! "limit": 4,! "total": 16! }
  10. Additional Resources (no pun intended) http://bit.ly/apiWeekly <- we do the

    hard work http://shop.oreilly.com/product/ 9780596529260.do http://TheAPIDesignBook.com http://videos.restfest.org http://AustinAPI.com