Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
REST API Design, Part I
Search
Nate Abele
August 29, 2013
Programming
1
200
REST API Design, Part I
Given at PHP Undiscovered, SF.
Nate Abele
August 29, 2013
Tweet
Share
More Decks by Nate Abele
See All by Nate Abele
Running Kubernetes in the Browser. Yes, really. Not really. Kind of.
nateabele
1
20
Un-dux Your Front-End
nateabele
1
97
CloudFormation For Fun & Profit (But Mostly Sanity)
nateabele
0
65
Functional Reactive Systems
nateabele
1
140
ngPittsburgh - AngularUI Router Philosophy
nateabele
1
1k
The Future of Programming
nateabele
1
470
Past, Present, and Future: The Evolution of PHP Development
nateabele
1
520
The Future of Programming: PHP Argentina 2014
nateabele
1
110
Designing Hypermedia APIs
nateabele
4
630
Other Decks in Programming
See All in Programming
Amazon S3 NYJavaSIG 2024-12-12
sullis
0
110
KMP와 kotlinx.rpc로 서버와 클라이언트 동기화
kwakeuijin
0
190
毎日13時間もかかるバッチ処理をたった3日で60%短縮するためにやったこと
sho_ssk_
1
370
各クラウドサービスにおける.NETの対応と見解
ymd65536
0
180
【re:Growth 2024】 Aurora DSQL をちゃんと話します!
maroon1st
0
810
快速入門可觀測性
blueswen
0
410
ブラウザ単体でmp4書き出すまで - muddy-web - 2024-12
yue4u
3
500
今年一番支援させていただいたのは認証系サービスでした
satoshi256kbyte
1
260
暇に任せてProxmoxコンソール 作ってみました
karugamo
2
730
Stackless и stackful? Корутины и асинхронность в Go
lamodatech
0
970
20年もののレガシープロダクトに 0からPHPStanを入れるまで / phpcon2024
hirobe1999
0
840
EC2からECSへ 念願のコンテナ移行と巨大レガシーPHPアプリケーションの再構築
sumiyae
2
440
Featured
See All Featured
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
95
17k
Documentation Writing (for coders)
carmenintech
67
4.5k
Fashionably flexible responsive web design (full day workshop)
malarkey
405
66k
Product Roadmaps are Hard
iamctodd
PRO
50
11k
VelocityConf: Rendering Performance Case Studies
addyosmani
326
24k
The Language of Interfaces
destraynor
154
24k
The Art of Delivering Value - GDevCon NA Keynote
reverentgeek
8
1.2k
Producing Creativity
orderedlist
PRO
342
39k
GitHub's CSS Performance
jonrohan
1031
460k
Done Done
chrislema
182
16k
Dealing with People You Can't Stand - Big Design 2015
cassininazir
365
25k
Statistics for Hackers
jakevdp
796
220k
Transcript
RESTFUL API DESIGN
Every time someone mentions RESTful web services, there’s always that
one person that has to chime in: “That’s not really RESTful, it’s just kinda RESTful.” — Steve Klabnik
THE RICHARDSON MATURITY MODEL • Level 0: RPC over HTTP
• Level 1: Resources vs. single service endpoint • Level 2: HTTP Verbs vs. URL-based method calls • Level 3: Hypermedia controls
BASICALLY, A CONTENT-NEGOTIATED STATE MACHINE
<link rel="stylesheet" href="default.css" type="text/css" title="Default Style" />
<form method="POST" action="/items"> <input type="text" name="title" /> </form>
<link rel="next" href="/next" type="content/type" title="Next!" />
MEANINGFUL RESPONSE CODES • 201: Created • 202: We’ll get
back to you • 304: Use the copy I gave you last time • 400: WTF URL parameters • 401: Authentication • 403: Access control
MEANINGFUL RESPONSE CODES • 406: I refuse to speak XML
• 410: Soft deletes • 415: I refuse to listen to XML • 418: Useless, I wanted coffee • 422: Validation failed • 429: Chill out • 451: Legal told me not to • 503: Network/database/dependent service issues
SCALE
VERSIONING?
application/vnd.my-company.app+json; version=2.2 ? X-Version: 2.2 ?
INTENTS
http://api.fbi.gov/wanted? order_by=notoriety,desc& limit=10& page=1& fields=name,aka,known_associates, reward,description,last_seen vs. http://api.fbi.gov/wanted/most https://mathieu.fenniak.net/stop-designing-fragile-web-apis/