@almadcz, @apiaryio
Lukas Linhart
CLIENT-CENTRIC
API DEVELOPMENT
Hi, I am Lukas @almadcz and I work for http://apiary.io.
Slide 2
Slide 2 text
We want API providers to stop inflicting pain on API consumers
Slide 3
Slide 3 text
Fancy way of exposing your database table. This is *not* a good design
!
Slide 4
Slide 4 text
let me tell you why we do things, what keeps us up at night
Slide 5
Slide 5 text
You shouldn’t be egoistic and only look at your model of the world
Slide 6
Slide 6 text
CLIENT-CENTRIC
Good API starts with good questions. How is your api going to be used?
Slide 7
Slide 7 text
It’s same as building business: find users/customers, validate & iterate.
Slide 8
Slide 8 text
You are going to find out about their culture.
Slide 9
Slide 9 text
You may find a quicky clients, but you should know what they want before saying no.
Slide 10
Slide 10 text
EXPRESSING INTENT
Just write it as you would ask them in an e-mail, only with small markdown annotations
(actually API Blueprint, http://apiblueprint.org/)
Slide 11
Slide 11 text
USER TESTING
This blueprint (via apiary.io) gives you mock server, so you can foce your client to start
developing.
Slide 12
Slide 12 text
Now you both can make prorotype—not only of API, but of the client application. That’s where
the dragons lie: in user interaction. That’s where you going to find out about missing fields,
bad resources…
Slide 13
Slide 13 text
…and you can iterate. Independently, having versioned text-file to talk in, and playing with the
design (every client may even have multiple mock versions, sending pull-request after their
idea is verified).
Slide 14
Slide 14 text
TDD/BDD DONE RIGHT
• Usage of the (web) API first
• intent - test (serving as documentation) - implement - watch
for regressions
• …documentation (serving as a test)
The point of TDD is not to have test. The point is to think about what the given method should
do and how it’s best invoked / used.
!
This is the same on API level.
Slide 15
Slide 15 text
DREDD
As for the last phase, dredd is a tool to verify blueprint is in sync with your implementation.
Put this into your CI!
Slide 16
Slide 16 text
Start today and do baby steps. You don’t introduce tests into big project by big 100% coverage
testing project— you start by covering the things you develop and refactor.
!
Start doing this to your API now.