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

Hypermedia APIs – Why, what, how?

Hypermedia APIs – Why, what, how?

High-level view of Hypermedia APIs from a pragmatic viewpoint. Presented at Helsinki Ruby Brigade January 2014 meet-up.

Vesa Vänskä

January 13, 2014
Tweet

More Decks by Vesa Vänskä

Other Decks in Programming

Transcript

  1. Hypermedia APIs
    Why, what, how?
    Vesa Vänskä, Kisko Labs
    Helsinki Ruby Brigade, Rails Girls

    View full-size slide

  2. What if all changes of
    the backend wouldn't
    require an update to
    the frontend?

    View full-size slide

  3. Current state is like
    brittle Selenium tests

    View full-size slide

  4. HyperText is a way to link
    and access information of
    various kinds as a web of
    nodes in which the user
    can browse at will.
    — Tim Berners-Lee, 1992

    View full-size slide

  5. URLs in the
    response aka
    HATEOAS

    View full-size slide

  6. https://developer.paypal.com/docs/api/#hateoas-links

    View full-size slide

  7. http://37signals.com/svn/posts/3373-getting-hyper-
    about-hypermedia-apis

    View full-size slide

  8. Increased flexibility

    View full-size slide

  9. Example: Feature
    needs to be
    disabled

    View full-size slide

  10. Example: Form
    fields need to be
    changed

    View full-size slide

  11. How would you
    build a
    Hypermedia API?

    View full-size slide

  12. State machine

    View full-size slide

  13. Following a link
    changes the state

    View full-size slide

  14. http://whyidentity.blogspot.fi/2013/04/hypermedia-
    links-in-paypal-restful-apis.html

    View full-size slide

  15. http://www.jayway.com/2012/10/06/why-hypermedia-
    apis/

    View full-size slide

  16. • Response generators
    • Clients
    • Documentation tools
    Tooling

    View full-size slide

  17. Swagger
    http://developers.helloreverb.com/swagger/

    View full-size slide

  18. Books
    Designing Hypermedia APIs by Steve Klabnik

    View full-size slide

  19. Other resources
    A Hypermedia API Reading List
    http://blog.steveklabnik.com/posts/
    2012-02-27-hypermedia-api-reading-list

    View full-size slide

  20. Future ambitions

    View full-size slide

  21. Media-type
    standardization
    JSON Schema, HAL, Collection+JSON etc.

    View full-size slide

  22. Unified
    documentation

    View full-size slide

  23. Thank you!
    twitter.com/vesan
    vesavanska.com

    View full-size slide