Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
REST API Design, Part II
Search
Nate Abele
August 30, 2013
Programming
240
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
100
Un-dux Your Front-End
nateabele
1
170
CloudFormation For Fun & Profit (But Mostly Sanity)
nateabele
0
100
Functional Reactive Systems
nateabele
1
210
ngPittsburgh - AngularUI Router Philosophy
nateabele
1
1.2k
The Future of Programming
nateabele
1
620
Past, Present, and Future: The Evolution of PHP Development
nateabele
1
670
The Future of Programming: PHP Argentina 2014
nateabele
1
150
Designing Hypermedia APIs
nateabele
4
750
Other Decks in Programming
See All in Programming
R8 の設定見直しでアプリサイズ削減
andpad
0
210
IBM Bob でAI駆動開発『QC-Playbook』
ichirokano2
0
110
難しいけど、読めた。- OSSの入口に立った話。
sts11142
0
150
Ghostty + Neovimで作る 透明でカッコ良い開発環境
j341nono
0
170
Kubernetes祭り #2 OP/ED
bells17
0
110
最近”作らせてる” ローカルAIアプリの話
akit37
0
440
複雑なUIコンポーネントとの ⻑い付き合い⽅:波及するバグからテスト戦略を経て、安全な再設計へ
mixplace
0
370
モデルのリファクタリングが難しいと思ったら、そもそも複雑だったのはビジネス仕様だった ? / is-the-business-domain-the-real-complexity
hatsu38
0
460
AI主導のプログラミング学習アプリを作ってみた
econanringo
0
160
IBM Bob Dojo #1 仕様駆動開発入門
oniak3ibm
PRO
0
380
[Rails World 2026] Durable orchestration on Rails: from continuation to workflow
palkan
1
710
re:Inventに行く前に知っておきたい現地参加のノウハウ
nokomoro3
0
400
Featured
See All Featured
WENDY [Excerpt]
tessaabrams
14
40k
Abbi's Birthday
coloredviolet
4
10k
Game over? The fight for quality and originality in the time of robots
wayneb77
1
300
Chasing Engaging Ingredients in Design
codingconduct
0
350
AI in Enterprises - Java and Open Source to the Rescue
ivargrimstad
0
1.5k
The Curse of the Amulet
leimatthew05
3
15k
Believing is Seeing
oripsolob
1
240
Test your architecture with Archunit
thirion
2
2.4k
First, design no harm
axbom
PRO
2
1.3k
How to optimise 3,500 product descriptions for ecommerce in one day using ChatGPT
katarinadahlin
PRO
3
3.9k
Leo the Paperboy
mayatellez
10
2.4k
The MySQL Ecosystem @ GitHub 2015
samlambert
251
13k
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