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.

Battelfield REST, API Development from the trenches

1,143 views

Published on

In this presentation we discuss the decisions that brought us to API development and why we focus just on delivering solutions around this technology.
We discuss the implications of organizational learning and defining a systematic approach to API development with the goal of being able to automate as much as we can of the software development process.
Eventually, we discuss the implementation choices we have made to accommodate advanced REST API requirements and the need to extend existing tooling.

Published in: Software
  • Be the first to comment

  • Be the first to like this

Battelfield REST, API Development from the trenches

  1. 1. Battlefield REST API's from the trenches Daniel Cerecedo @dcerecedo
  2. 2. Agenda StrategicDrivers TacticalChoices Language Frameworkdilemma Tools Downtothetrenches URIs Representations Hypermedia Views Updates&Concurrency NextSteps @dcerecedoByteflair
  3. 3. Strategic Drivers @dcerecedoByteflair
  4. 4. Strategic Drivers Agility&Flexibility Heraclitus @dcerecedoByteflair “Thereisnothing permanentbutchange”
  5. 5. Strategic Drivers Growth @dcerecedoByteflair
  6. 6. Strategic Drivers RESTful Web Services @dcerecedoByteflair
  7. 7. Strategic Drivers Servicedependability Timetomarket Quality @dcerecedoByteflair
  8. 8. Strategic Drivers Puttingitalltogether @dcerecedoByteflair Quality Dependability Speed Cost
  9. 9. Strategic Drivers Jackofalltrades, Masterofnone Achievingdependability @dcerecedoByteflair
  10. 10. Strategic Drivers Climbfaster,deliverfaster @dcerecedoByteflair Automate
  11. 11. Strategic Drivers Puttingitalltogether @dcerecedoByteflair DevelopmentCosts #ProjectsExecuted Every time output is doubled cost per unit falls by 15%
  12. 12. “1.000 days to develop, 10.000 days to polish” @dcerecedoByteflair Miyamoto Mushashi
  13. 13. Tactical Choices @dcerecedoByteflair
  14. 14. @dcerecedoByteflair “Weapons should be adapted to your personal qualities and be one you can handle” Tactical Choices Miyamoto Mushashi
  15. 15. Tactical Choices Java&Spring @dcerecedoByteflair Community,Availability&QualityofLibraries Scalability&Deployability ObjectOriented&TypeSafe Wearealreadygoodatit
  16. 16. Tactical Choices @dcerecedoByteflair Here,wedoitthe PHPway
  17. 17. Tactical Choices @dcerecedoByteflair SpeedFlexibility Theframeworkdilemma
  18. 18. Tactical Choices @dcerecedoByteflair Tools Swagger Postman
  19. 19. “It is deplorable to die with weapons left in their scabbards” @dcerecedoByteflair Miyamoto Mushashi
  20. 20. Down to the trenches @dcerecedoByteflair
  21. 21. URIs @dcerecedoByteflair
  22. 22. URIs Whatistheresource? /collection/{id} Default @dcerecedoByteflair
  23. 23. URIs Whatistheresource? /collection;id={id} /collection;slug={slug} /collection/{id};field={fieldName} MultipleId's @dcerecedoByteflair
  24. 24. URIs BhasuniqueidswithinA Bhasuniversaluniqueids A B 1 N Nesting @dcerecedoByteflair
  25. 25. URIs Whatistheresourceandcontext? /collection_a/{aid}/collection_b/{bid} A B 1 N Nesting–UniqueId'swithinA @dcerecedoByteflair
  26. 26. URIs Whatistheresourceandcontext? /collection_a/{aid}/collection_b/ /collection_a/{aid}/collection_b/{bid} /collection_b/{bid} A B 1 N Nesting–UniversalUniqueId's @dcerecedoByteflair
  27. 27. URIs Whyprovidecontextto universalid's? FasterqueriesinNoSQL (nested docs) { } @dcerecedoByteflair
  28. 28. URIs A B N N Nesting–UniversalUniqueId's A C 1 N B 1 N @dcerecedoByteflair ...andapplythesamerecipe ...normalize...
  29. 29. URIs Nesting–AnoteonUsers @dcerecedoByteflair /users/{uid}/collection_b/{bid} Fortheconnecteduser: /collection_b/{bid}
  30. 30. URIs Calculations @dcerecedoByteflair Createaficticiousresource
  31. 31. Representation @dcerecedoByteflair
  32. 32. Representation HTTPStatusCode HTTPHeaders HTTPResponseBody OverloadingHTTP @dcerecedoByteflair
  33. 33. Representation HTTPStatusCode Success Error IdentifyingResponseOutcome @dcerecedoByteflair
  34. 34. Representation HTTPStatusprovidescontext ResponseBodyprovidesdetail { “code”: 123, “message”:“sourceoftheproblem”, “hint”:“givemewaystoovercomethisobstacle” } Error @dcerecedoByteflair
  35. 35. Representation { “error”:null, “data”:{…} } Error { “error”:{…}, “data”:null } NO @dcerecedoByteflair
  36. 36. Representation { “field_a”:“value”, “field_b”:value, ...} Success @dcerecedoByteflair [ {…}, {…}, ...]
  37. 37. Representation { “size”:7, “data”:[ {…}, {…}, ... ] } Error NO @dcerecedoByteflair
  38. 38. Representation Ifthereisnoneedtowrapresponses Don'tdoit @dcerecedoByteflair
  39. 39. Representation HTTPHeaders Elementsinthearray Anymetadataaboutthecurrentresponse @dcerecedoByteflair Metadata
  40. 40. Representation @dcerecedoByteflair ExpansionandProjections Don't be opinionated about the client
  41. 41. Representation @dcerecedoByteflair Views
  42. 42. Representation @dcerecedoByteflair Updates&Concurrency
  43. 43. Hypermedia @dcerecedoByteflair
  44. 44. Hypermedia @dcerecedoByteflair SHOW ME THE MONEY
  45. 45. Hypermedia @dcerecedoByteflair URI'sareId's “id”: “5ef321” “id”:{ “_link”:“http://api.domain.com/collection/5ef321” } “id”: “http://api.domain.com/collection/5ef321”
  46. 46. Hypermedia @dcerecedoByteflair Referencing “author”:{ “_link”:“http://api.domain.com/users/5ef321” } “messages”:[{ “_link”:“http://api.domain.com/picks/3976dh }, { “_link”:“http://api.domain.com/picks/3976dh },...]
  47. 47. Hypermedia HTTPHeaders Paginationlinks Linktothecreatedresource @dcerecedoByteflair Metadata
  48. 48. Moving On @dcerecedoByteflair
  49. 49. @dcerecedoByteflair “Be victorious today over what you were yesterday” Miyamoto Mushashi
  50. 50. ? Daniel Cerecedo @dcerecedo

×