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
Un-dux Your Front-End
nateabele
1
90
CloudFormation For Fun & Profit (But Mostly Sanity)
nateabele
0
58
Functional Reactive Systems
nateabele
1
130
ngPittsburgh - AngularUI Router Philosophy
nateabele
1
960
The Future of Programming
nateabele
1
400
Past, Present, and Future: The Evolution of PHP Development
nateabele
1
430
The Future of Programming: PHP Argentina 2014
nateabele
1
100
Designing Hypermedia APIs
nateabele
4
600
REST API Design, Part II
nateabele
1
190
Other Decks in Programming
See All in Programming
Amazon Aurora Serverless v2が意外と高かった話と、AWS Database Migration Serviceの話
satoshi256kbyte
1
110
FoodGram
iseruuuuu
0
230
Ruby on Fails - effective error handling with Rails conventions
talyssonoc
0
280
The Cutting Edge Of Versioning (LambdaConf 2024)
chriskrycho
0
250
Kotlin Multiplatform at Stable and Beyond (Android Makers 2024)
zsmb
0
600
How to improve maintainability and readability of your automated tests? ( #scrumniigata )
teyamagu
PRO
1
120
Let's learn code review
riofujimon
2
630
CREってこういうこと? 体験入社 - 提案資料 - / what-is-cre-trial-employment
shinden
1
620
教えて!スクラムコーチ品質とスピードのバランスはどうすりゃいいの?
pinboro
0
100
Native Federation: The Future of Micro Frontends in Angular
manfredsteyer
PRO
0
170
RaaP
ksss
0
140
slow types ってなんだろう?
karad
0
210
Featured
See All Featured
Rebuilding a faster, lazier Slack
samanthasiow
74
8.3k
The Cult of Friendly URLs
andyhume
74
5.7k
The Psychology of Web Performance [Beyond Tellerrand 2023]
tammyeverts
15
1.6k
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
323
20k
Robots, Beer and Maslow
schacon
PRO
155
8k
A Philosophy of Restraint
colly
197
16k
No one is an island. Learnings from fostering a developers community.
thoeni
16
2.1k
Making the Leap to Tech Lead
cromwellryan
125
8.6k
Adopting Sorbet at Scale
ufuk
69
8.6k
How To Stay Up To Date on Web Technology
chriscoyier
782
250k
Bootstrapping a Software Product
garrettdimon
PRO
302
110k
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
26
2.3k
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/