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

12 Reasons your API Sucks (2017 Rev)

12 Reasons your API Sucks (2017 Rev)

(Revised for 2017)

Just like there are code smells through the rest of your project, there are API smells that make them hard to design, hard to launch, and hard to maintain. We’ll use this time to explore a few common APIs to highlight those issues and demonstrate strategies to fix the issues before they become problems.

Those first moments of using an API are pivotal. There’s nothing like downloading this week’s PDF of the documentation, setting up a SOAP client, reconfiguring all your URLs, and decoding the latest binary payloads. It makes your heart sing and your blood pressure rise.

Keith Casey

August 09, 2017
Tweet

More Decks by Keith Casey

Other Decks in Technology

Transcript

  1. AGENDA • Assumptions • Developer Experience • Love at First

    Byte • Adoption • Day to Day @CaseySoftware
  2. AGENDA • Assumptions • Developer Experience • Love at First

    Byte • Adoption • Day to Day @CaseySoftware
  3. ASSUMPTIONS • APIs are an important part of your job

    • Use them on a regular basis • Potentially build them too • Sometimes public, sometimes private @CaseySoftware
  4. ASSUMPTIONS • Nothing is perfect • You make mistakes •

    Your providers make mistakes • That other team are knuckleheads @CaseySoftware
  5. AGENDA • Assumptions • Developer Experience • Love at First

    Byte • Adoption • Day to Day @CaseySoftware
  6. – D. Keith Casey, Jr. aka That guy in front

    of you, right now “Developers are users too”
  7. “I SET ASIDE AN HOUR…” • Not really, but you

    really tried… • phone calls, emails, IM, Slack, etc, etc • “Do you have a minute?” • TPS reports
  8. AGENDA • Assumptions • Developer Experience • Love at First

    Byte • Adoption • Day to Day @CaseySoftware
  9. 1. DOCUMENTATION • Ways to deliver documentation • PDF -

    [redacted] • HTML - https://github.com/lord/slate
  10. 1. DOCUMENTATION (CONT) • Let’s get interactive! • Swagger -

    http://docs.clarify.io/api/ (Open API) • RAML, JSON Schema, API Blueprint
  11. SDK docs != API docs Good API docs = Reference

    Docs + Howtos 2. INCOMPLETE DOCS
  12. 4. “INNOVATIVE” INTERFACES • You created your own… • HTTP

    verbs • Response codes • Or your own flippin’ protocols
  13. • Don’t roll your own “encryption” scheme • Don’t roll

    your own “new” methods 5. AUTHENTICATION
  14. • Use an existing scheme like OAuth • Less (zero?)

    training required • Reuse common libraries for clients & server • Faster on boarding 5. AUTHENTICATION
  15. AGENDA • Assumptions • Developer Experience • Love at First

    Byte • Adoption • Day to Day @CaseySoftware
  16. 6. INCONSISTENCIES • Accounts • Contacts • ContactHistories • Users

    • ContactGroupings /api/v1/accounts /api/v1/contacts /api/v1/contact_histories ??? ??? @CaseySoftware
  17. • Accounts • Contacts • ContactHistories • Users • ContactGroupings

    /api/v1/accounts /api/v1/contacts /api/v1/contact_histories /api/v1/users /api/v1/contact_groupings 6. INCONSISTENCIES @CaseySoftware
  18. • Accounts • Contacts • ContactHistories • Users • ContactGroupings

    /api/v1/accounts /api/v1/contacts /api/v1/contact_histories /api/v1/users/current.json /api/v1/contact/:id/groupings 6. INCONSISTENCIES @CaseySoftware
  19. 201, Location header ??? 201, Location header 201, Location header

    201, Location header POST -d {data} /api/v1/accounts /api/v1/contacts /api/v1/contact_histories /api/v1/users/current.json /api/v1/contact/:id/groupings 6. INCONSISTENCIES @CaseySoftware
  20. 201, Location header 200, Resource 201, Location header 201, Location

    header 201, Location header POST -d {data} /api/v1/accounts /api/v1/contacts /api/v1/contact_histories /api/v1/users/current.json /api/v1/contact/:id/groupings 6. INCONSISTENCIES @CaseySoftware
  21. • Affordances • What problems/tasks does it makes simple? •

    What is the API producer’s goal? • What do you want to do? 7. POOR MODELING @CaseySoftware
  22. AGENDA • Assumptions • Developer Experience • Love at First

    Byte • Adoption • Day to Day @CaseySoftware
  23. 9. YOUR SH.. STUFF IS BROKEN • Is Support run

    by developers? • What does your uptime look like? • Do you have a Trust page? @CaseySoftware
  24. RECAP • Assumptions • Developer Experience • Love at First

    Byte • Adoption • Day to Day @CaseySoftware
  25. STARTING • Documentation • Consumable • Accurate & Complete •

    Examples • Simplicity in Code & Interfaces @CaseySoftware
  26. BUILDING • Consistent aka “Principle of Least Surprise” • Designed

    Workflows • The One True Way • Authentication @CaseySoftware
  27. HEY JERK. THAT WAS ONLY 11. WHAT KIND OF GAME

    ARE YOU PLAYING HERE? @CaseySoftware