API Design at Eventbrite

API Design at Eventbrite

A short talk given as part of the Eventbrite "Advanced Django" workshop at Pycon 2014

077e9a0cb34fa3eba2699240c9509717?s=128

Andrew Godwin

April 10, 2014
Tweet

Transcript

  1. API Design at Andrew Godwin @andrewgodwin

  2. The Problem

  3. Two existing APIs: APIv1 at least 6 years old APIv2

    never finished and now too specialised
  4. Outdated: No provision for new features Some interfaces locked down

    to old ideas (e.g. payment)
  5. Bad patterns: Same domain as main site /xml/?method=access_code_new Both XML

    and JSON as return formats, transformed from each other.
  6. The Task Build a new API for the modern era

  7. SOA Match it as closely as possible

  8. Event service Venue service Order service Payment service SOA Client

  9. Event service Venue service Order service Payment service SOA Client

    APIv3 API Client
  10. Future-proof Allow for more features easily

  11. Maintainable Make sure it's easier to extend than start again

  12. The Basis

  13. The Basis Django REST Framework

  14. The Basis Django REST Framework Custom SOA/API coupling

  15. The Basis Django REST Framework Custom SOA/API coupling Piecemeal refactors

    of current code
  16. The Basis Django REST Framework Custom SOA/API coupling Piecemeal refactors

    of current code APIv1 as initial target to start deprecation
  17. Design Principles

  18. JSON only Mapping XML ←→ JSON rarely works well

  19. REST (ish) Sensible paths, sensible verbs

  20. /events/ /events/39992/ /events/39992/orders/ /events/39992/publish/ /users/me/owned_events/ POST: New event GET: Event

    details POST: Update event GET: List of orders /events/39992/orders/12392/ GET: Order details POST: Publish event GET: List of your events DELETE: Delete event
  21. Every response is {} Leaves room for new features/pagination

  22. Pagination everywhere And standardised, so there's no surprises

  23. Introspectable parameters For our documentation and API explorer

  24. None
  25. None
  26. Always more to do Documentation, consistency, and new features

  27. Try it today! http://developer.eventbrite.com

  28. Thanks. @andrewgodwin andrewgodwin@eventbrite.com