30
Versions are evil Leviticus 0xFEFF Just after something about shellfish

Versions are evil – how to do without in your API

Embed Size (px)

Citation preview

Page 1: Versions are evil – how to do without in your API

Versions are evil

Leviticus 0xFEFF Just after something about shellfish

Page 2: Versions are evil – how to do without in your API

http://api.equestria.magic/v1/

Page 3: Versions are evil – how to do without in your API

COOL URIS DON’T CHANGE

Page 4: Versions are evil – how to do without in your API

Uniform

Resource

Identifier

Page 5: Versions are evil – how to do without in your API
Page 6: Versions are evil – how to do without in your API

http://v1.api.equestria.magic/

Page 7: Versions are evil – how to do without in your API

URIS ARE OPAQUEIt’s dark in the smuog

Page 8: Versions are evil – how to do without in your API

http://not-so-opengraph.api.equestria.magic/

Page 9: Versions are evil – how to do without in your API
Page 10: Versions are evil – how to do without in your API
Page 11: Versions are evil – how to do without in your API

> GET /rainbow-dash > Host: api.equestria.magic > Accept: application/vnd.equestria.ponies.v1+xml

< 200 OK < Content-Type: application/vnd.equestria.ponies.v1+xml < ..

Page 12: Versions are evil – how to do without in your API

“We encourage resource ownersto only use true content negotiation (without redirects) when the only difference between formats is mechanical in nature.”

Roy Fielding

Page 13: Versions are evil – how to do without in your API

A conversation I could have had

“User: I need the gravatar of /user/rainbow-dash - Me: it’s only in the v2 format

- User: But there’s no @accept on <img>! - Me: No kidding.”

Page 14: Versions are evil – how to do without in your API

WHY ARE WE THERE?

Page 15: Versions are evil – how to do without in your API

“In the world of Web services, there is a strong argument that contracts should be stored and transmitted in a machine-readable format.”

A guy called Don

Page 16: Versions are evil – how to do without in your API

Frozen in time?

Page 17: Versions are evil – how to do without in your API

Evolution

Page 18: Versions are evil – how to do without in your API

BACKWARD COMPATIBILITY

Page 19: Versions are evil – how to do without in your API

“A product or technology is backward […] compatible if it can work with input generated by an older product”

The source of all truths Wikipedia

Page 20: Versions are evil – how to do without in your API

FORWARD COMPATIBILITY

Page 21: Versions are evil – how to do without in your API

“A forward compatible design can accept data from a future version of itself and pick out the "known" part of the data”

42 Wikipedia

Page 22: Versions are evil – how to do without in your API

XML Schemas

<xsd:any> <xsd:anyAttribute>

Page 23: Versions are evil – how to do without in your API

JSON

“No one has been stupid enough yet to create a JSON schema language”

Delusional person in the street

Page 24: Versions are evil – how to do without in your API

Ignore the unknown

• Degrading when possible • Ignore what is not understood.monkey-dash { coolness: 100%; }

Page 25: Versions are evil – how to do without in your API

Fallback rules

<input type=“monkey” />

Page 26: Versions are evil – how to do without in your API

DON’T VALIDATE SCHEMAS

Page 27: Versions are evil – how to do without in your API

REALLY, DON’T.

Page 28: Versions are evil – how to do without in your API

Style, or substance

<user> <address> Somewhere over the rainbow. </address> <monkey-business enabled=“true” /> </user>

Noise

Datum

Page 29: Versions are evil – how to do without in your API

DATUMS DON’T KILL PEOPLE, SCHEMAS KILL PEOPLE.

Those pesky schemas. Tsk tsk.

Page 30: Versions are evil – how to do without in your API