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

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

De23af005c790b22f8ce4d201e6ca027?s=128

Benjamin Encz

March 28, 2018
Tweet

Transcript

  1. BENJAMIN ENCZ @BENJAMINENCZ 1 — Beyond REST | @benjaminencz |

    PlanGrid, March 2018
  2. BEYOND REST BUILDING HYBRID APIS THAT WORK FOR WEB AND

    MOBILE 2 — Beyond REST | @benjaminencz | PlanGrid, March 2018
  3. 3 — Beyond REST | @benjaminencz | PlanGrid, March 2018

  4. ! HISTORY TIME! 4 — Beyond REST | @benjaminencz |

    PlanGrid, March 2018
  5. 2000 5 — Beyond REST | @benjaminencz | PlanGrid, March

    2018
  6. REPRESENTATIONAL STATE TRANSFER "ARCHITECTURAL STYLES AND THE DESIGN OF NETWORK-BASED

    SOFTWARE ARCHITECTURES" ROY FIELDING, 2000 6 — Beyond REST | @benjaminencz | PlanGrid, March 2018
  7. ▸ Client-Server (Architecture) ▸ Stateless (Scale) ▸ Uniform Interface (Discoverability!)

    7 — Beyond REST | @benjaminencz | PlanGrid, March 2018
  8. 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
  9. "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
  10. APIS AT PLANGRID 10 — Beyond REST | @benjaminencz |

    PlanGrid, March 2018
  11. Developer Tools for Construction Focus on project execution, after spec

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

    API 4. (Inter-service APIs) 12 — Beyond REST | @benjaminencz | PlanGrid, March 2018
  13. WEB APIS 13 — Beyond REST | @benjaminencz | PlanGrid,

    March 2018
  14. 14 — Beyond REST | @benjaminencz | PlanGrid, March 2018

  15. /SHEETS /ANNOTATIONS /USERS /STAMP_DEFAULTS 15 — Beyond REST | @benjaminencz

    | PlanGrid, March 2018
  16. 16 — Beyond REST | @benjaminencz | PlanGrid, March 2018

  17. Web APIs should provide data in a shape that is

    required by a view 17 — Beyond REST | @benjaminencz | PlanGrid, March 2018
  18. /SHEET-VIEWER/FOR-SHEET/{UID} ! 18 — Beyond REST | @benjaminencz | PlanGrid,

    March 2018
  19. 19

  20. 20 — Beyond REST | @benjaminencz | PlanGrid, March 2018

  21. 21

  22. ▸ 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
  23. MOBILE APIS FOR APPS WITH OFFLINE CAPABILITIES 23 — Beyond

    REST | @benjaminencz | PlanGrid, March 2018
  24. DATA REPLICATION! 24 — Beyond REST | @benjaminencz | PlanGrid,

    March 2018
  25. 25 — Beyond REST | @benjaminencz | PlanGrid, March 2018

  26. 26 — Beyond REST | @benjaminencz | PlanGrid, March 2018

  27. 27 — Beyond REST | @benjaminencz | PlanGrid, March 2018

  28. /ANNOTATIONS/SYNC 28 — Beyond REST | @benjaminencz | PlanGrid, March

    2018
  29. ▸ 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
  30. DATA MUTATION IN REST APIS 30 — Beyond REST |

    @benjaminencz | PlanGrid, March 2018
  31. Applications: state + operations 31 — Beyond REST | @benjaminencz

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

    Beyond REST | @benjaminencz | PlanGrid, March 2018
  33. { 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
  34. For writes, offline capable clients already "think" in terms of

    operations, not state transfers 34 — Beyond REST | @benjaminencz | PlanGrid, March 2018
  35. REST & operations: another impedance mismatch 35 — Beyond REST

    | @benjaminencz | PlanGrid, March 2018
  36. PUBLIC PLANGRID API 36 — Beyond REST | @benjaminencz |

    PlanGrid, March 2018
  37. REST IS DEAD LONG LIVE REST 37 — Beyond REST

    | @benjaminencz | PlanGrid, March 2018
  38. PLANGRID APIS IN FUTURE 38 — Beyond REST | @benjaminencz

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

    pattern - REST and data replication - REST and operations 39 — Beyond REST | @benjaminencz | PlanGrid, March 2018
  40. 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
  41. Don't Reinvent The Wheel, Unless You Plan on Learning More

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

    good docs, tooling and onboarding 42 — Beyond REST | @benjaminencz | PlanGrid, March 2018
  43. THANK YOU! Slides https://speakerdeck.com/benjamin_encz/ We have jobs: https://www.plangrid.com/careers/ @BENJAMINENCZ 43

    — Beyond REST | @benjaminencz | PlanGrid, March 2018
  44. 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
  45. RESOURCES - 2/2 Coding Horror on reinventing wheels: https://blog.codinghorror.com/dont-reinvent-the-wheel-unless-you- plan-on-learning-more-about-wheels/

    45 — Beyond REST | @benjaminencz | PlanGrid, March 2018