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
200
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
26
Un-dux Your Front-End
nateabele
1
99
CloudFormation For Fun & Profit (But Mostly Sanity)
nateabele
0
69
Functional Reactive Systems
nateabele
1
140
ngPittsburgh - AngularUI Router Philosophy
nateabele
1
1.1k
The Future of Programming
nateabele
1
480
Past, Present, and Future: The Evolution of PHP Development
nateabele
1
540
The Future of Programming: PHP Argentina 2014
nateabele
1
110
Designing Hypermedia APIs
nateabele
4
640
Other Decks in Programming
See All in Programming
お前もAI鬼にならないか?👹Bolt & Cursor & Supabase & Vercelで人間をやめるぞ、ジョジョー!👺
taishiyade
5
3.9k
Amazon S3 TablesとAmazon S3 Metadataを触ってみた / 20250201-jawsug-tochigi-s3tables-s3metadata
kasacchiful
0
120
ISUCON14公式反省会LT: 社内ISUCONの話
astj
PRO
0
190
なぜイベント駆動が必要なのか - CQRS/ESで解く複雑系システムの課題 -
j5ik2o
9
3.4k
“あなた” の開発を支援する AI エージェント Bedrock Engineer / introducing-bedrock-engineer
gawa
11
1.9k
SpringBoot3.4の構造化ログ #kanjava
irof
2
980
iOSエンジニアから始める visionOS アプリ開発
nao_randd
3
130
定理証明プラットフォーム lapisla.net
abap34
1
1.8k
2,500万ユーザーを支えるSREチームの6年間のスクラムのカイゼン
honmarkhunt
6
5.2k
法律の脱レガシーに学ぶフロントエンド刷新
oguemon
5
730
[JAWS-UG横浜 #80] うわっ…今年のServerless アップデート、少なすぎ…?
maroon1st
1
180
GitHub Actions × RAGでコードレビューの検証の結果
sho_000
0
250
Featured
See All Featured
How GitHub (no longer) Works
holman
313
140k
Typedesign – Prime Four
hannesfritz
40
2.5k
Designing Experiences People Love
moore
139
23k
StorybookのUI Testing Handbookを読んだ
zakiyama
28
5.5k
Thoughts on Productivity
jonyablonski
69
4.5k
Helping Users Find Their Own Way: Creating Modern Search Experiences
danielanewman
29
2.4k
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
251
21k
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
33
2.1k
Practical Tips for Bootstrapping Information Extraction Pipelines
honnibal
PRO
12
960
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
132
33k
Fantastic passwords and where to find them - at NoRuKo
philnash
51
3k
GitHub's CSS Performance
jonrohan
1030
460k
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