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

Beyond Rest - Building Hybrid APIs that work for Web and Mobile

Beyond Rest - Building Hybrid APIs that work for Web and Mobile

Benjamin Encz

March 28, 2018
Tweet

More Decks by Benjamin Encz

Other Decks in Programming

Transcript

  1. BEYOND REST BUILDING HYBRID APIS THAT WORK FOR WEB AND

    MOBILE 2 — Beyond REST | @benjaminencz | PlanGrid, March 2018
  2. REPRESENTATIONAL STATE TRANSFER "ARCHITECTURAL STYLES AND THE DESIGN OF NETWORK-BASED

    SOFTWARE ARCHITECTURES" ROY FIELDING, 2000 6 — Beyond REST | @benjaminencz | PlanGrid, March 2018
  3. CORE TENETS OF "UNIFORM INTERFACE" CONSTRAINT "identification of resources; manipulation

    of resources through representations; self-descriptive messages; and, hypermedia as the engine of application state" EXTREMELY USEFUL FOR PUBLIC APIS! 8 — Beyond REST | @benjaminencz | PlanGrid, March 2018
  4. "The trade-off, though, is that a uniform interface degrades efficiency

    [...] optimizing for the common case of the Web, but resulting in an interface that is not optimal for other forms of architectural interaction." 9 — Beyond REST | @benjaminencz | PlanGrid, March 2018
  5. Developer Tools for Construction Focus on project execution, after spec

    has been written 11 — Beyond REST | @benjaminencz | PlanGrid, March 2018
  6. 1. Private Web API 2. Private Mobile API 3. Public

    API 4. (Inter-service APIs) 12 — Beyond REST | @benjaminencz | PlanGrid, March 2018
  7. Web APIs should provide data in a shape that is

    required by a view 17 — Beyond REST | @benjaminencz | PlanGrid, March 2018
  8. 19

  9. 21

  10. ▸ Single API request to gather data ▸ Frontend can

    evolve without requiring new endpoints ▸ Good API evolvability without versioning 22 — Beyond REST | @benjaminencz | PlanGrid, March 2018
  11. MOBILE APIS FOR APPS WITH OFFLINE CAPABILITIES 23 — Beyond

    REST | @benjaminencz | PlanGrid, March 2018
  12. ▸ Sync endpoints implement bespoke database replication protocol (for reads

    only) ▸ Currently tied to one resource (based on REST) but might change in future 29 — Beyond REST | @benjaminencz | PlanGrid, March 2018
  13. DATA MUTATION IN REST APIS 30 — Beyond REST |

    @benjaminencz | PlanGrid, March 2018
  14. "User A assigned Issue X to User B" 32 —

    Beyond REST | @benjaminencz | PlanGrid, March 2018
  15. { issue_uid: X assignees: [] } Diff two JSON objects,

    reverse engineer changes out of them { issue_uid: X assignees: [{user_uid: B}] } 33 — Beyond REST | @benjaminencz | PlanGrid, March 2018
  16. For writes, offline capable clients already "think" in terms of

    operations, not state transfers 34 — Beyond REST | @benjaminencz | PlanGrid, March 2018
  17. REST IS DEAD LONG LIVE REST 37 — Beyond REST

    | @benjaminencz | PlanGrid, March 2018
  18. Impedance mismatches between: - REST and typical web application read

    pattern - REST and data replication - REST and operations 39 — Beyond REST | @benjaminencz | PlanGrid, March 2018
  19. Using a REST-like API internally today, but moving away from

    a few core tenets as we see other more suitable approaches 40 — Beyond REST | @benjaminencz | PlanGrid, March 2018
  20. Don't Reinvent The Wheel, Unless You Plan on Learning More

    About Wheels — codinghorror.com 41 — Beyond REST | @benjaminencz | PlanGrid, March 2018
  21. Right tool for job > following industry standards Supported by

    good docs, tooling and onboarding 42 — Beyond REST | @benjaminencz | PlanGrid, March 2018
  22. RESOURCES - 1/2 GraphQL schema stitching blog post: https://dev-blog.apollodata.com/graphql-schema- stitching-8af23354ac37

    Filtered replication in PouchDB: https://pouchdb.com/2015/04/05/filtered-replication.html 44 — Beyond REST | @benjaminencz | PlanGrid, March 2018