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 II
Search
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
Nate Abele
August 30, 2013
Programming
230
1
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
REST API Design, Part II
Given at PHP Undiscovered, SF.
Nate Abele
August 30, 2013
More Decks by Nate Abele
See All by Nate Abele
Running Kubernetes in the Browser. Yes, really. Not really. Kind of.
nateabele
1
88
Un-dux Your Front-End
nateabele
1
160
CloudFormation For Fun & Profit (But Mostly Sanity)
nateabele
0
99
Functional Reactive Systems
nateabele
1
200
ngPittsburgh - AngularUI Router Philosophy
nateabele
1
1.2k
The Future of Programming
nateabele
1
610
Past, Present, and Future: The Evolution of PHP Development
nateabele
1
670
The Future of Programming: PHP Argentina 2014
nateabele
1
140
Designing Hypermedia APIs
nateabele
4
730
Other Decks in Programming
See All in Programming
信頼性の目標を誰も求めてない
shubox
0
490
Laravelのアプリケーションをどこにデプロイするか #ツナギメオフライン.9
akase244
0
110
自分的「カンファレンスの楽しみ方」
syumai
0
190
KotlinConf Extended South Korea 2026 Keynote
l2hyunwoo
0
130
業務時間外もAIに働いてもらう話
colorful12
3
9.9k
ハーネス設計入門 〜プロンプト、コンテキストの次〜
kinopeee
53
35k
Hello, Hiroshima Geospatial Data! — Exploring DoboX with Python
ra0kley
0
170
Press start. Python's next generation.
willingc
PRO
3
300
Discordを用いたラボオートメーション関連情報収集の自動化
noguhiro2002
0
500
AIは賢い。でも実行環境は? CLIおじさんがAI時代に伝えたいこと ~ CLIおじさんがAI時代に伝えたいこと ~
curekoshimizu
1
140
Seeing Through Serverless: Observability for AWS Lambda with ADOT and CloudWatch Application Signals
seike460
PRO
1
120
ソフトウェアラスタライザ
fadis
1
780
Featured
See All Featured
More Than Pixels: Becoming A User Experience Designer
marktimemedia
3
510
The browser strikes back
jonoalderson
0
1.6k
How to Align SEO within the Product Triangle To Get Buy-In & Support - #RIMC
aleyda
2
1.8k
Jamie Indigo - Trashchat’s Guide to Black Boxes: Technical SEO Tactics for LLMs
techseoconnect
PRO
0
660
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
32
4.6k
The Pragmatic Product Professional
lauravandoore
37
7.4k
Primal Persuasion: How to Engage the Brain for Learning That Lasts
tmiket
0
440
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
133
19k
Large-scale JavaScript Application Architecture
addyosmani
515
110k
YesSQL, Process and Tooling at Scale
rocio
174
15k
The Limits of Empathy - UXLibs8
cassininazir
1
640
Jess Joyce - The Pitfalls of Following Frameworks
techseoconnect
PRO
1
410
Transcript
The Dream of the 90’s is Withering on the Vine
(in Portland)
How to Future-Proof & Increase The Level of Sanity in
the Design of Your APIs, by Respecting the Best Practices of HTTP Or...
This is Roy
Principles • Client-Server • Stateless • Cacheable • Uniform Interface
• Opaque Layering • Code-on-Demand
Objectives •Auth •Querying •Relationships •Pagination •Formats •Caching •Logging •API Versioning
Auth •Simple! •Basic vs. Digest (over SSL, obviously) •Upshot of
Basic: http://user:
[email protected]
/objects •Cookies? •Custom Tokens?
Querying •There are approaches to making this discoverable •They are
ridiculously ivory-tower •Better: ?q=<whatever>
Relationships •Goal: Introspect API domain model and transform object relationships
to URLs
Relationships GET /tasks HTTP/1.1 [{ title: "Finish client demo", completed:
false, _links: { self: { href: "http://my.app/tasks/1138" }, owner: { href: "http://my.app/users/nate" }, subtasks: { href: "http://my.app/tasks/1138/subtasks" } } }]
Pagination GET /tasks?page=5&order=due ?
Pagination HTTP Range! GET /videos/rickroll.mp4 Range: bytes=100-99999
Pagination HEAD /tasks HTTP/1.1 ... HTTP 200 OK Accept-Ranges: tasks
Pagination HEAD /posts HTTP/1.1 ... HTTP 200 OK Accept-Ranges: posts
Pagination GET /posts HTTP/1.1 Range: posts=1-20
Caching (Strategies) • Generated cache keys (ETag, If-None-Match) • For
writes: If-Match • Time-based (Last-Modified / If-Modified-Since)
Logging Custom Response Headers!
Logging X-Query-Log: SELECT * From users WHERE name = "nate"
X-Query-Log: SELECT * From tasks WHERE user_id = 13
Logging X-Query-Log: users.find({ name: "nate" })
DEMO