Transcript
Page 1: PyCon PL 2014   executable api

Good API documentation is

executableWojtek Erbetowski

@erbetowski

Page 2: PyCon PL 2014   executable api

I’m a programmer

Page 3: PyCon PL 2014   executable api

Community activist

Page 4: PyCon PL 2014   executable api

Head of Engineering at Polidea

Page 5: PyCon PL 2014   executable api

Polidea is all about mobile

Page 6: PyCon PL 2014   executable api

What is this presentation about?

A little bit about why

A little bit about why not

More about how

Page 7: PyCon PL 2014   executable api

Do you document your API?

How many do not document?

How many document on paper/wiki?

Page 8: PyCon PL 2014   executable api

none/specs

WikiOther

How is your API documented?

Page 9: PyCon PL 2014   executable api

Do you do WIKI?

unhappy

happy

Page 10: PyCon PL 2014   executable api

Do you do WIKI?

consumers

providers

Page 11: PyCon PL 2014   executable api

Simple and easy

Easy to create/change

Easy to modify by nontechnical

Page 12: PyCon PL 2014   executable api

Not accurate!

Easily gets out of sync

You never know whether it’s you or them

Not strict

Often inconsistent

Page 13: PyCon PL 2014   executable api

How to do it better?

Page 14: PyCon PL 2014   executable api

What if ...

… you had plenty of time and money?

Page 15: PyCon PL 2014   executable api

Facebook Graph API

Page 16: PyCon PL 2014   executable api

DYI solutions

Page 17: PyCon PL 2014   executable api

Where’s the value?

Easier to keep up-to-date

Versioning

Non-developers may read and maintain

Page 18: PyCon PL 2014   executable api

Not only for big players!

RAML

Swagger

Apiary

I/O Docs

Apigee

...

Page 19: PyCon PL 2014   executable api
Page 20: PyCon PL 2014   executable api

Most popular tool

Apiary

Swagger

RAML

Page 21: PyCon PL 2014   executable api

“Give a man an API, and he APIs for a day. Teach a man to API, and he APIs for a lifetime.”

Swagger

Page 22: PyCon PL 2014   executable api

RAML

API first

Readability

Mocking service

Page 23: PyCon PL 2014   executable api

An API Is Only As Good As Its Documentation

Apiary

Page 24: PyCon PL 2014   executable api

Comparison

Swagger RAML Apiary

Executable x x x

API Platform x x

Great UI x x

Readability x x

Easily generated x

Scenarios x

Page 25: PyCon PL 2014   executable api

Future?

Page 26: PyCon PL 2014   executable api
Page 27: PyCon PL 2014   executable api

Summary

Page 28: PyCon PL 2014   executable api

Your docs can be better!

Get the best of two worlds:

● easy to keep up-to-date

● simple to create/edit

Page 29: PyCon PL 2014   executable api

Start with Swagger

simplest in configuration

generates docs from current code

Page 30: PyCon PL 2014   executable api

Big decision

Generated vs design first

Page 31: PyCon PL 2014   executable api

QUOTES

Page 32: PyCon PL 2014   executable api

“I could generate docs from existing app”

about Swagger and Jersey

Page 33: PyCon PL 2014   executable api

“It fails during functional tests before we see it”

about mocs generated from documentation

Page 34: PyCon PL 2014   executable api

“It’s very hard to return ‘{}’but how about ‘null’ ? ”

how technology stack affects API design

Page 35: PyCon PL 2014   executable api

Q&A

Page 36: PyCon PL 2014   executable api

Thank you