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

How to build a Unified API

Simon Wood
October 25, 2013

How to build a Unified API

Presentation on APIs at FOWA 2013

Simon Wood

October 25, 2013
Tweet

More Decks by Simon Wood

Other Decks in Programming

Transcript

  1. How to
    Build a
    Unified API

    View Slide

  2. Simon Wood
    @hpoom
    Holiday Extras
    Image by Barney Livingston - Flickr

    View Slide

  3. @hpoom

    View Slide

  4. @hpoom
    Over 40m visits
    and 500k bookings
    in the last 5 years
    Give £20m revenue
    to hotels each year

    View Slide

  5. @hpoom

    View Slide

  6. Because of APIs I can tell you...
    Yesterday
    I walked
    6191 steps
    FitBit API
    The music
    I listen to
    most is
    Radiohead
    Last.fm API
    It is
    currently
    13ºC in
    New York
    Yahoo Weather API
    The Brewery is
    located at
    lat: 51.520475
    lon: -0.091471
    Google Maps API
    @hpoom

    View Slide

  7. The Future is mobile
    The Future is social
    The Future is cloud
    @hpoom

    View Slide

  8. The Future is mobile
    The Future is social
    The Future is cloud
    The Future
    is APIs
    @hpoom

    View Slide

  9. APIs
    Mobile
    Social Cloud
    @hpoom Diagram by Sam Ramji - http://bit.ly/biz-apis

    View Slide

  10. What I am going to cover
    The Problem
    Solutions - Good and Bad
    Considerations
    Technology
    How you can do this too
    @hpoom

    View Slide

  11. LET’S TALK ABOUT
    THE PROBLEM
    @hpoom

    View Slide

  12. Multiple
    sources
    of data
    @hpoom

    View Slide

  13. @hpoom

    View Slide

  14. Multiple
    consumers
    of data
    @hpoom

    View Slide

  15. Shortbreaks traffic
    breakdown 18 months
    @hpoom
    Desktop Tablet Mobile

    View Slide

  16. @hpoom

    View Slide

  17. De couple
    @hpoom

    View Slide

  18. Hide
    legacy
    @hpoom

    View Slide

  19. Speed!
    @hpoom

    View Slide

  20. Source: Strangeloop Networks Case Study
    Amazon
    100
    milliseconds
    revenue
    1%
    Mozilla
    2.2
    seconds
    downloads
    60m
    per year
    @hpoom

    View Slide

  21. Scaleability
    @hpoom

    View Slide

  22. Be efficient
    with resource
    @hpoom

    View Slide

  23. SO WHAT IS THE
    THE SOLUTION
    @hpoom

    View Slide

  24. The
    Unified
    Bit
    @hpoom

    View Slide

  25. Website
    Application
    Layer
    Legacy
    Reservation System
    @hpoom

    View Slide

  26. Website
    Application
    Layer & API
    Legacy
    Reservation System
    Affiliates
    @hpoom

    View Slide

  27. Website
    Application
    Layer & API
    Legacy
    Reservation System
    Affiliates
    Hotel System Ticket System
    @hpoom

    View Slide

  28. Website
    Application
    Layer & API
    Legacy
    Reservation System
    Affiliates
    Hotel System Ticket System
    @hpoom

    View Slide

  29. Unified API
    Website Mobile App Affiliates Smart TV
    Hotels Tickets Transport Food
    Multiple consumers of data
    Multiple sources of data
    @hpoom

    View Slide

  30. Proxy
    @hpoom

    View Slide

  31. Website
    Application
    Layer
    Legacy
    Reservation System
    @hpoom

    View Slide

  32. Website
    Application
    Layer
    Unified API
    Legacy
    Reservation System
    New System
    Proxy
    @hpoom

    View Slide

  33. Hierarchical
    @hpoom

    View Slide

  34. Website
    Application
    Layer
    Unified API
    Legacy
    Reservation System
    New System
    @hpoom

    View Slide

  35. Website
    Application
    Layer
    Unified API
    Product API Content API
    Price &
    Availability
    Name
    Star Rating
    Facilities
    @hpoom

    View Slide

  36. Website
    Application
    Layer
    Unified API
    Product API Content API
    Hotels Tickets Transport
    @hpoom

    View Slide

  37. Website
    Application
    Layer
    Unified API
    Product API Content API
    Hotels Tickets Transport
    Legacy New Affiliate
    @hpoom

    View Slide

  38. Micro-service
    architecture
    Idea by Fred George - http://bit.ly/fred-george
    @hpoom

    View Slide

  39. Traditional
    Enterprise
    Architecture
    Micro
    Service
    Architecture
    Diagram by James Hughes - http://bit.ly/micro-service
    @hpoom

    View Slide

  40. Website
    Application
    Layer
    Unified API
    Content API
    @hpoom

    View Slide

  41. Authentication
    @hpoom

    View Slide

  42. Unified API
    Website Mobile App Affiliates Smart TV
    Hotels Tickets Transport Food
    Auth
    Use
    OAuth 2.0
    @hpoom

    View Slide

  43. Standardise
    your payloads
    @hpoom

    View Slide

  44. PUBLIC SERVICE
    ANNOUNCEMENT
    @hpoom
    This is THE correct way
    to write numeric dates
    2013-10-25
    Source XKCD - http://bit.ly/iso-date

    View Slide

  45. Checksum
    tricks
    @hpoom
    MD5 ("Checksum tricks") =
    1aef67e94cf84d9c4200e24cbdc9f93d

    View Slide

  46. Cache &
    async
    requests
    @hpoom

    View Slide

  47. Unified API
    Website Mobile App Affiliates Smart TV
    Hotels Tickets Transport Food
    Async
    Total request time is only as
    slow as the slowest provider
    1.2s 0.8s
    1.1s 0.6s
    @hpoom

    View Slide

  48. Unified API
    Website Mobile App Affiliates Smart TV
    Hotels Tickets Transport Food
    Cache
    Cache Cache Cache Cache
    If we hit the
    top cache
    respond in
    0.04s
    @hpoom

    View Slide

  49. In summary
    Solutions
    Unified API
    Standard Payloads
    Micro Services
    Proxy
    Cache & Async
    Hierarchical
    Problems
    Multi Data Sources
    Multi Consumers
    Decouple
    Hide Legacy
    Speed
    Scaleability
    @hpoom

    View Slide

  50. SOME
    CONSIDERATIONS
    @hpoom

    View Slide

  51. Open &
    Commercial
    @hpoom

    View Slide

  52. The right
    way to
    rate limit
    @hpoom

    View Slide

  53. Unlimited
    pools of
    talent
    @hpoom Chris Jason, ESPN - http://bit.ly/espnapi

    View Slide

  54. Debugging
    & Logs
    @hpoom

    View Slide

  55. Our log data in loggly
    @hpoom

    View Slide

  56. 300k
    unique
    payloads
    3GB
    JSON
    logged daily
    @hpoom

    View Slide

  57. WHAT
    TECHNOLOGY?
    @hpoom

    View Slide

  58. We use...
    @hpoom
    express
    web application
    framework for
    node

    View Slide

  59. Yesterday’s
    Standard
    SOAP
    XML
    Today’s
    Standard
    REST
    JSON
    Keep it simple!
    @hpoom

    View Slide

  60. @hpoom

    View Slide

  61. Language
    does not
    matter
    @hpoom

    View Slide

  62. WHERE TO
    START?
    @hpoom

    View Slide

  63. What do
    you hate?
    @hpoom

    View Slide

  64. Where are
    you going?
    @hpoom

    View Slide

  65. Which public
    APIs could
    you
    consume?
    @hpoom

    View Slide

  66. Who needs
    access?
    @hpoom

    View Slide

  67. Good
    docs
    @hpoom Pusher Blog - http://bit.ly/devapidocs

    View Slide

  68. TAKE
    AWAYS
    @hpoom

    View Slide

  69. Consume your
    own APIs
    @hpoom
    uses to build
    Source Zach Holman - http://bit.ly/githubdogfood
    uses to build

    View Slide

  70. @hpoom
    “You wouldn't really
    think that an online
    bookstore needs to be
    an extensible,
    programmable
    platform. Would you?”
    Steve Yegge
    Source Steve Yegge - http://bit.ly/yegge

    View Slide

  71. The future of
    web apps is
    Unified APIs
    @hpoom

    View Slide

  72. Thanks
    http://bit.ly/unifiedapi
    @hpoom
    We’re hiring - http://bit.ly/hx-sb
    twitter
    +
    github
    Simon Wood

    View Slide