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

5 features of a good API

5 features of a good API

Everyone is writing APIs from micro-services through to full applications, but what makes a good one? In this session we’ll go back to the basics and look at what I consider to be five of the more important architectural features that you should think about when creating an API. These are the features that ensure that your API plays well with HTTP and, more importantly, make your API a delight to maintain and work with. I want you to ensure that your API is a good HTTP citizen, while also providing developer-friendly features like thoughtful error handling and documentation.

This presentation was given at RestFest UK.

Avatar for Rob Allen

Rob Allen

July 16, 2016

More Decks by Rob Allen

Other Decks in Technology

Transcript

  1. Malleable • The representation is independent of the DB schema

    • Design is based on state changes • Hypermedia aware Rob Allen ~ @akrabat
  2. Correct • Media type format suits the design • Correct

    use of HTTP verbs • Understanding of Idempotency • Richardson Maturity Model 2+ Rob Allen ~ @akrabat
  3. Great error handling • Error representations are first class citizens

    • Honours accept header • Correct content-type • Uses correct HTTP status code • Provides application error code & human readable message • ideally in a known media type such as api-problem Rob Allen ~ @akrabat
  4. BC break policy • A new version is a new

    API • Has a deprecation policy Rob Allen ~ @akrabat
  5. Human documentation • Sensible URLs • There's less of it!

    • Tutorials • Semantic information Rob Allen ~ @akrabat