• Oct 30, 2023
  • Rule #0: DON'T get pedantic
  • Rule #1: DO use plural nouns for collections
  • Rule #2: DON'T add unnecessary path segments
  • Rule #3: DON'T add .json or other extensions to the url
  • Rule #4: DON'T return arrays as top level responses
  • Rule #5: DON'T return map structures
  • Exception to the no-map rule
  • Rule #6: DO use strings for all identifiers
  • Rule #7: DO prefix your identifiers
  • Rule #8: DON'T use 404 to indicate "not found"
  • Rule #9: BE consistent
  • Rule #10: DO use a structured error format
  • Rule #11: DO provide idempotence mechanisms
  • A Brief Primer On Idempotence
  • Good option: An "idempotency key" or "client reference ID"
  • Good option: Let the client pick IDs
  • Crappy option: Provide an endpoint to list recent transactions
  • When a conflict occurs...
  • Return an error
  • Return the earlier response
  • TL;DR
  • Rule #12: DO use ISO8601 strings for timestamps
  • Rule #12a: Use ISO8601 for all date/time-related values
  • Rule #12b: DON'T trust your language/platform defaults
  • Conclusion