As we enter the era of taste, I want to talk about practical ways you can write more TASTEful APIs.
I Error messages
Stripe returns errors in plain English: “That card number doesn’t look right.” Not
ERROR_INVALID_PARAMETER
. Because developers debug at 2am.
- developers debug at 2am
- the unhappy path is more important than the happy path.
- wrap your errors in a loving, gentle ribbon.
II The API is the product
- the API is the product. Act like a product person. don’t get lost in the code.
- this is how to make an API that is irresistible to developers.
- we don’t make shitty GUIs, so don’t write shitty APIs.
- you are an author.
III Time to first ‘Hello World’
- how long it would take for a non-technical person to get their first successful response from your API?
- adjust accordingly.
IV Developers should be able to guess your API even without reading the documentation.
- maximize predictability
- minimize surprise
V Don’t overdo it
It’s easy to add new features to an API, but hard to remove them.
- be intentional with the surface area of your API.
- more surface area ≠ better.
- don’t put your users in configuration paralysis.
- let each endpoint be responsible for exactly one thing.
Implementation is trivial. Taste is hard.