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
220
1
Share
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
70
Un-dux Your Front-End
nateabele
1
150
CloudFormation For Fun & Profit (But Mostly Sanity)
nateabele
0
88
Functional Reactive Systems
nateabele
1
180
ngPittsburgh - AngularUI Router Philosophy
nateabele
1
1.1k
The Future of Programming
nateabele
1
570
Past, Present, and Future: The Evolution of PHP Development
nateabele
1
630
The Future of Programming: PHP Argentina 2014
nateabele
1
130
Designing Hypermedia APIs
nateabele
4
710
Other Decks in Programming
See All in Programming
Swift Concurrency Type System
inamiy
0
530
PDI: Como Alavancar Sua Carreira e Seu Negócio
marcelgsantos
0
120
JOAI2026 1st solution - heron0519 -
heron0519
0
140
AI時代のPhpStorm最新事情 #phpcon_odawara
yusuke
0
190
SREに優しいTerraform構成 modulesとstateの組み方
hiyanger
2
130
「Linuxサーバー構築標準教科書」を読んでみた #ツナギメオフライン.7
akase244
0
1.4k
CDK Deployのための ”反響定位”
watany
4
780
一度始めたらやめられない開発効率向上術 / Findy あなたのdotfilesを教えて!
k0kubun
4
3k
2026_04_15_量子計算をパズルとして解く
hideakitakechi
0
110
Liberating Ruby's Parser from Lexer Hacks
ydah
2
1.3k
UIの境界線をデザインする | React Tokyo #15 メイントーク
sasagar
2
360
CursorとClaudeCodeとCodexとOpenCodeを実際に比較してみた
terisuke
1
470
Featured
See All Featured
The #1 spot is gone: here's how to win anyway
tamaranovitovic
2
1k
Everyday Curiosity
cassininazir
0
200
The Invisible Side of Design
smashingmag
303
52k
Neural Spatial Audio Processing for Sound Field Analysis and Control
skoyamalab
0
260
Skip the Path - Find Your Career Trail
mkilby
1
110
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
55
3.3k
Measuring & Analyzing Core Web Vitals
bluesmoon
9
810
10 Git Anti Patterns You Should be Aware of
lemiorhan
PRO
659
61k
Leadership Guide Workshop - DevTernity 2021
reverentgeek
1
270
Designing for Timeless Needs
cassininazir
0
200
Ruling the World: When Life Gets Gamed
codingconduct
0
210
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