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
Nate Abele
August 30, 2013
Programming
1
210
REST API Design, Part II
Given at PHP Undiscovered, SF.
Nate Abele
August 30, 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
53
Un-dux Your Front-End
nateabele
1
110
CloudFormation For Fun & Profit (But Mostly Sanity)
nateabele
0
80
Functional Reactive Systems
nateabele
1
160
ngPittsburgh - AngularUI Router Philosophy
nateabele
1
1.1k
The Future of Programming
nateabele
1
530
Past, Present, and Future: The Evolution of PHP Development
nateabele
1
600
The Future of Programming: PHP Argentina 2014
nateabele
1
120
Designing Hypermedia APIs
nateabele
4
680
Other Decks in Programming
See All in Programming
ALL CODE BASE ARE BELONG TO STUDY
uzulla
27
6.6k
kiroとCodexで最高のSpec駆動開発を!!数時間で web3ネイティブなミニゲームを作ってみたよ!
mashharuki
0
830
登壇は dynamic! な営みである / speech is dynamic
da1chi
0
350
はじめてのDSPy - 言語モデルを『プロンプト』ではなく『プログラミング』するための仕組み
masahiro_nishimi
3
6.4k
PHPに関数型の魂を宿す〜PHP 8.5 で実現する堅牢なコードとは〜 #phpcon_hiroshima / phpcon-hiroshima-2025
shogogg
1
320
Things You Thought You Didn’t Need To Care About That Have a Big Impact On Your Job
hollycummins
0
250
AI Agent 時代的開發者生存指南
eddie
4
2k
バッチ処理を「状態の記録」から「事実の記録」へ
panda728
PRO
0
180
「ちょっと古いから」って避けてた技術書、今だからこそ読もう
mottyzzz
11
7k
20251016_Rails News ~Rails 8.1の足音を聴く~
morimorihoge
2
660
Claude CodeによるAI駆動開発の実践 〜そこから見えてきたこれからのプログラミング〜
iriikeita
0
320
Android16 Migration Stories ~Building a Pattern for Android OS upgrades~
reoandroider
0
130
Featured
See All Featured
Fight the Zombie Pattern Library - RWD Summit 2016
marcelosomers
234
17k
How To Stay Up To Date on Web Technology
chriscoyier
791
250k
Stop Working from a Prison Cell
hatefulcrawdad
271
21k
Designing for Performance
lara
610
69k
Why You Should Never Use an ORM
jnunemaker
PRO
59
9.6k
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
132
19k
BBQ
matthewcrist
89
9.8k
No one is an island. Learnings from fostering a developers community.
thoeni
21
3.5k
Embracing the Ebb and Flow
colly
88
4.9k
Site-Speed That Sticks
csswizardry
13
920
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
359
30k
Learning to Love Humans: Emotional Interface Design
aarron
274
41k
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