Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Hypermedia is Dead. Long Live Hypermedia!

531 views

Published on

HATEOAS – the concept of using hypermedia as the engine of application state is dead. Numerous companies have tried to incorporate hypermedia, and only a few have succeeded – but at what cost and what benefit. With the REST hypothesis tried and failed, we now look towards new solutions and methods. Hypermedia is dead. Or, is it? In this session we’ll take a look at hypermedia, including how it enables us to do everyday tasks while humbly laying in the background. And we’ll take a look at what it really means to be “hypermedia driven,” why it is a critical constraint in REST, why so many companies have failed, and how to successfully incorporate hypermedia in a way that drives value for both your company and your consumers.

Published in: Software
  • Be the first to comment

  • Be the first to like this

Hypermedia is Dead. Long Live Hypermedia!

  1. 1. 1 | © 2018 RingCentral, Inc. All rights reserved. Hypermedia is DEAD. LONG LIVE HYPERMEDIA. @mikegstowe
  2. 2. 2 | © 2018 RingCentral, Inc. All rights reserved. IMPORTANT HANDLES @mikegstowe @ringcentraldevs This is me. This keeps me from getting fired…
  3. 3. 3 | © 2018 RingCentral, Inc. All rights reserved. HATEOAS may be the purists’ choice, but it does come with a certain amount of baggage. It makes an API more complex to implement while tending to bloat the response. It can give rise to a more ‘chatty’ style of integration as clients navigate through links rather than jumping straight in to the resources they need. More importantly, in many cases it fails to deliver on its stated benefits.” “ - Ben Morris
  4. 4. 4 | © 2018 RingCentral, Inc. All rights reserved. If hypermedia is so great, how come nobody is using it?” “ - John Wang
  5. 5. 5 | © 2018 RingCentral, Inc. All rights reserved. That’s just not how things work.” “ - David (DHH)
  6. 6. 6 | © 2018 RingCentral, Inc. All rights reserved. RESTful APIs are dead, long live GraphQL” “ - José María Rodríguez Hurtado
  7. 7. 7 | © 2018 RingCentral, Inc. All rights reserved. The end.
  8. 8. 8 | © 2018 RingCentral, Inc. All rights reserved. How can the API be dead when APIs are more important and plentiful than ever?.. “ - doveltech
  9. 9. 9 | © 2018 RingCentral, Inc. All rights reserved. Finally, hypermedia as the engine of application state – the dreaded HATEOAS – is perhaps the most overlooked of the REST constraints, even though it’s the most important… “ - doveltech
  10. 10. 10 | © 2018 RingCentral, Inc. All rights reserved. What so many techies lose sight of is the fact that REST isn’t supposed to make the Web more like system integration; it’s meant to make system integration more like the Web. “ - doveltech
  11. 11. 11 | © 2018 RingCentral, Inc. All rights reserved. So what exactly is this… hypermedia?
  12. 12. 12 | © 2018 RingCentral, Inc. All rights reserved. Required Constraints: § Client-Server – each can evolve independently § Stateless – server does not store state § Cache – server dictates cache to client § Uniform Interface – utilizes resources, hypermedia § Layered System – multiple layers to prevent failure REST
  13. 13. 13 | © 2018 RingCentral, Inc. All rights reserved. Hyper•text (noun), beyond text or text with links HYPERMEDIA
  14. 14. 14 | © 2018 RingCentral, Inc. All rights reserved. Hyper•text (noun), beyond text or text with links Hyper•media (noun), beyond media or media with links HYPERMEDIA
  15. 15. 15 | © 2018 RingCentral, Inc. All rights reserved. Simply put, hypermedia is the engine that helps drive the uniform interface. Without hypermedia, you cannot have REST. HYPERMEDIA
  16. 16. 16 | © 2018 RingCentral, Inc. All rights reserved. What needs to be done to make the REST architectural style clear on the notion that hypertext is a constraint? In other words, 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. Is there some broken manual somewhere that needs to be fixed?” “ - Roy Fielding, Creator of REST
  17. 17. 17 | © 2018 RingCentral, Inc. All rights reserved. So why is hypermedia so important?
  18. 18. 18 | © 2018 RingCentral, Inc. All rights reserved. Hypermedia is more than just links. It is context, flexibility, and discoverability. HYPERMEDIA
  19. 19. 19 | © 2018 RingCentral, Inc. All rights reserved. Hypermedia describes the application state, or the state of each item in the response, removing the business logic from the client. Context
  20. 20. 20 | © 2018 RingCentral, Inc. All rights reserved. This means a transition from stating the resource available, to the action that can be taken using formats like Siren or CPHL. Context
  21. 21. 21 | © 2018 RingCentral, Inc. All rights reserved. { “name” : “Mike”, “state” : “pending” } Context
  22. 22. 22 | © 2018 RingCentral, Inc. All rights reserved. { “name” : “Mike”, “state” : “pending” “_links” : { “approve” : { “href” : “…”, “methods” : [“put”] }, “reject” : { “href” : “…” , “methods” : [“put”] }, “delete” : { “href” : “…” , “methods” : [“delete”] } } } Context CPHL
  23. 23. 23 | © 2018 RingCentral, Inc. All rights reserved. { “to” : “555-555-5555”, “message” : “test SMS message” “status” : “queued” } Context
  24. 24. 24 | © 2018 RingCentral, Inc. All rights reserved. { “to” : “555-555-5555”, “message” : “test SMS message” “status” : “queued”, “_links” : { “cancel” : { “href” : “…”, “methods” : [“post”] }, } } Context CPHL
  25. 25. 25 | © 2018 RingCentral, Inc. All rights reserved. { “to” : “555-555-5555”, “message” : “test SMS message” “status” : “sent” } Context
  26. 26. 26 | © 2018 RingCentral, Inc. All rights reserved. { “to” : “555-555-5555”, “message” : “test SMS message” “status” : “received”, “_links” : { “details” : { “href” : “…”, “methods” : [“get”] }, “sms_call_log” : { “href” : “…”, “methods” : [“get”] } } } Context CPHL
  27. 27. 27 | © 2018 RingCentral, Inc. All rights reserved. { […] “_links” : { “prev” : { “href” : “…”, “methods” : [“get”] }, “next” : { “href” : “…”, “methods” : [“get”] } } } Context CPHL
  28. 28. 28 | © 2018 RingCentral, Inc. All rights reserved. { … “_links” : { “self” : { “href” : “…” }, } } Context What not to do… HAL
  29. 29. 29 | © 2018 RingCentral, Inc. All rights reserved. […, { “user” : “Mike Stowe”, “_links” : { “read” : { “href” : “…”, “methods” : [“get”] }, } } … Context CPHL
  30. 30. 30 | © 2018 RingCentral, Inc. All rights reserved. Hypermedia is designed to allow for fluid transitions within the API, and changes to the resource URI structure without causing backwards breaks. Flexibility
  31. 31. 31 | © 2018 RingCentral, Inc. All rights reserved. Flexibility { "users": [{ "first_name": "Michael", "last_name": "Stowe", "_links": { "message": { "href": "/messages/?to=5", "method": ["post"] } } }] } CPHL
  32. 32. 32 | © 2018 RingCentral, Inc. All rights reserved. Flexibility { "users": [{ "first_name": "Michael", "last_name": "Stowe", "_links": { "message": { "href": "/messages/?to=5&tk=12345", "method": ["post"] } } }] } CPHL
  33. 33. 33 | © 2018 RingCentral, Inc. All rights reserved. { “name” : “Mike”, “_links” : { “message” : { “href” : “…”, “methods” : [“post”], ”title” : “Send Message” } } } Flexibility CPHL
  34. 34. 34 | © 2018 RingCentral, Inc. All rights reserved. “message” : { “href” : “…”, “methods” : [“post”], ”title” : “Send Message”, “code” : { “form” : {…}, “logic” : {…} } } Flexibility CPHL
  35. 35. 35 | © 2018 RingCentral, Inc. All rights reserved. Hypermedia is finally designed to provide a map of the API that can be programmatically followed by the machine. Discoverability
  36. 36. 36 | © 2018 RingCentral, Inc. All rights reserved. { “name” : “Mike”, “photos” : [ { “id” : 1, ”url” : “…”, “height” : “…” … }… Discoverability CPHL
  37. 37. 37 | © 2018 RingCentral, Inc. All rights reserved. { “name” : “Mike”, “_links” : { “friends” : { “href” : “…”, “methods” : [“get”] }, “photos” : { “href” : “…”, “methods” : [“get”] }, “videos” : { “href” : “…”, “methods” : [“get”] }, “articles” : { “href” : “…”, “methods” : [“get”] } } } Discoverability CPHL
  38. 38. 38 | © 2018 RingCentral, Inc. All rights reserved. WHAT DO THE APIs OF THE FUTURE LOOK LIKE?
  39. 39. 39 | © 2018 RingCentral, Inc. All rights reserved. § Version-less and self-healing § Self-serve/ discoverable § Autonomous, machine driven APIs of the Future
  40. 40. 40 | © 2018 RingCentral, Inc. All rights reserved. § Artificial intelligence and machine focused hypermedia specifications (siren, CPHL – github.com/mikestowe/cphl), etc) Chained requests allowing for single HTTP request with logical operations and data filtering (try it at bit.ly/apichain_spec & bit.ly/apichain_demos) § Code on Demand and dynamic implementations (JavaScript, Docker, etc) Tech of the Future
  41. 41. 41 | © 2018 RingCentral, Inc. All rights reserved. Hated the talk? Let me know! @mikegstowe @ringcentraldevs Loved the talk? Let my boss know! FIND ME ONLINE AT MIKESTOWE.COM
  42. 42. 42 | © 2018 RingCentral, Inc. All rights reserved. THANK YOU

×