Versions are evil – how to do without in your API
-
Upload
sebastien-lambla -
Category
Internet
-
view
2.477 -
download
0
Transcript of Versions are evil – how to do without in your API
![Page 1: Versions are evil – how to do without in your API](https://reader033.fdocuments.net/reader033/viewer/2022050613/58a069f91a28ab06528b587d/html5/thumbnails/1.jpg)
Versions are evil
Leviticus 0xFEFF Just after something about shellfish
![Page 2: Versions are evil – how to do without in your API](https://reader033.fdocuments.net/reader033/viewer/2022050613/58a069f91a28ab06528b587d/html5/thumbnails/2.jpg)
http://api.equestria.magic/v1/
![Page 3: Versions are evil – how to do without in your API](https://reader033.fdocuments.net/reader033/viewer/2022050613/58a069f91a28ab06528b587d/html5/thumbnails/3.jpg)
COOL URIS DON’T CHANGE
![Page 4: Versions are evil – how to do without in your API](https://reader033.fdocuments.net/reader033/viewer/2022050613/58a069f91a28ab06528b587d/html5/thumbnails/4.jpg)
Uniform
Resource
Identifier
![Page 5: Versions are evil – how to do without in your API](https://reader033.fdocuments.net/reader033/viewer/2022050613/58a069f91a28ab06528b587d/html5/thumbnails/5.jpg)
![Page 6: Versions are evil – how to do without in your API](https://reader033.fdocuments.net/reader033/viewer/2022050613/58a069f91a28ab06528b587d/html5/thumbnails/6.jpg)
http://v1.api.equestria.magic/
![Page 7: Versions are evil – how to do without in your API](https://reader033.fdocuments.net/reader033/viewer/2022050613/58a069f91a28ab06528b587d/html5/thumbnails/7.jpg)
URIS ARE OPAQUEIt’s dark in the smuog
![Page 8: Versions are evil – how to do without in your API](https://reader033.fdocuments.net/reader033/viewer/2022050613/58a069f91a28ab06528b587d/html5/thumbnails/8.jpg)
http://not-so-opengraph.api.equestria.magic/
![Page 9: Versions are evil – how to do without in your API](https://reader033.fdocuments.net/reader033/viewer/2022050613/58a069f91a28ab06528b587d/html5/thumbnails/9.jpg)
![Page 10: Versions are evil – how to do without in your API](https://reader033.fdocuments.net/reader033/viewer/2022050613/58a069f91a28ab06528b587d/html5/thumbnails/10.jpg)
![Page 11: Versions are evil – how to do without in your API](https://reader033.fdocuments.net/reader033/viewer/2022050613/58a069f91a28ab06528b587d/html5/thumbnails/11.jpg)
> 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](https://reader033.fdocuments.net/reader033/viewer/2022050613/58a069f91a28ab06528b587d/html5/thumbnails/12.jpg)
“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](https://reader033.fdocuments.net/reader033/viewer/2022050613/58a069f91a28ab06528b587d/html5/thumbnails/13.jpg)
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](https://reader033.fdocuments.net/reader033/viewer/2022050613/58a069f91a28ab06528b587d/html5/thumbnails/14.jpg)
WHY ARE WE THERE?
![Page 15: Versions are evil – how to do without in your API](https://reader033.fdocuments.net/reader033/viewer/2022050613/58a069f91a28ab06528b587d/html5/thumbnails/15.jpg)
“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](https://reader033.fdocuments.net/reader033/viewer/2022050613/58a069f91a28ab06528b587d/html5/thumbnails/16.jpg)
Frozen in time?
![Page 17: Versions are evil – how to do without in your API](https://reader033.fdocuments.net/reader033/viewer/2022050613/58a069f91a28ab06528b587d/html5/thumbnails/17.jpg)
Evolution
![Page 18: Versions are evil – how to do without in your API](https://reader033.fdocuments.net/reader033/viewer/2022050613/58a069f91a28ab06528b587d/html5/thumbnails/18.jpg)
BACKWARD COMPATIBILITY
![Page 19: Versions are evil – how to do without in your API](https://reader033.fdocuments.net/reader033/viewer/2022050613/58a069f91a28ab06528b587d/html5/thumbnails/19.jpg)
“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](https://reader033.fdocuments.net/reader033/viewer/2022050613/58a069f91a28ab06528b587d/html5/thumbnails/20.jpg)
FORWARD COMPATIBILITY
![Page 21: Versions are evil – how to do without in your API](https://reader033.fdocuments.net/reader033/viewer/2022050613/58a069f91a28ab06528b587d/html5/thumbnails/21.jpg)
“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](https://reader033.fdocuments.net/reader033/viewer/2022050613/58a069f91a28ab06528b587d/html5/thumbnails/22.jpg)
XML Schemas
<xsd:any> <xsd:anyAttribute>
![Page 23: Versions are evil – how to do without in your API](https://reader033.fdocuments.net/reader033/viewer/2022050613/58a069f91a28ab06528b587d/html5/thumbnails/23.jpg)
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](https://reader033.fdocuments.net/reader033/viewer/2022050613/58a069f91a28ab06528b587d/html5/thumbnails/24.jpg)
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](https://reader033.fdocuments.net/reader033/viewer/2022050613/58a069f91a28ab06528b587d/html5/thumbnails/25.jpg)
Fallback rules
<input type=“monkey” />
![Page 26: Versions are evil – how to do without in your API](https://reader033.fdocuments.net/reader033/viewer/2022050613/58a069f91a28ab06528b587d/html5/thumbnails/26.jpg)
DON’T VALIDATE SCHEMAS
![Page 27: Versions are evil – how to do without in your API](https://reader033.fdocuments.net/reader033/viewer/2022050613/58a069f91a28ab06528b587d/html5/thumbnails/27.jpg)
REALLY, DON’T.
![Page 28: Versions are evil – how to do without in your API](https://reader033.fdocuments.net/reader033/viewer/2022050613/58a069f91a28ab06528b587d/html5/thumbnails/28.jpg)
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](https://reader033.fdocuments.net/reader033/viewer/2022050613/58a069f91a28ab06528b587d/html5/thumbnails/29.jpg)
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](https://reader033.fdocuments.net/reader033/viewer/2022050613/58a069f91a28ab06528b587d/html5/thumbnails/30.jpg)