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
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
87
Un-dux Your Front-End
nateabele
1
160
CloudFormation For Fun & Profit (But Mostly Sanity)
nateabele
0
97
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
660
The Future of Programming: PHP Argentina 2014
nateabele
1
130
Designing Hypermedia APIs
nateabele
4
730
Other Decks in Programming
See All in Programming
「人を評価する AI」の設計と実装
ryoyanara
0
230
Jindong: Introducing Declarative Haptics in Compose Multiplatform
l2hyunwoo
0
130
in-process GraphQL のすすめ #ginzajs
izumin5210
4
1.5k
AI Engineeringは、AIプロダクトだけのものか? 〜AIがソフトウェアを作る時代の新しい当たり前〜 / No AI in your product. AI Engineering in your development.
rkaga
5
510
Android CLI
fornewid
0
230
ソフトウェアラスタライザ
fadis
1
550
書籍「プロフェッショナルAI駆動開発」紹介スライド
juntaromatsumoto
0
350
FastAPI の並行処理モデルを完全に理解する
hoto17296
8
2.8k
運用ダッシュボードの設計を誰も教えてくれないのだけどみなさんどうしてるんですか? - チームに監視するという文化を根付かせるための第一歩を踏みたい -
satoshi256kbyte
1
140
Press start. Python's next generation.
willingc
PRO
2
110
ソフトウェアエンジニアにとっての生成AI - 特性を知って使い倒す / generative ai for software enginner
kishida
7
2.1k
Pythonの実行はどこまで賢くなったのか? CPythonとPyPyから見る最適化のしくみ
curekoshimizu
3
1.8k
Featured
See All Featured
Sam Torres - BigQuery for SEOs
techseoconnect
PRO
0
500
A better future with KSS
kneath
240
18k
A Guide to Academic Writing Using Generative AI - A Workshop
ks91
PRO
1
380
Un-Boring Meetings
codingconduct
0
390
The AI Revolution Will Not Be Monopolized: How open-source beats economies of scale, even for LLMs
inesmontani
PRO
3
3.7k
How to build a perfect <img>
jonoalderson
1
5.9k
Between Models and Reality
mayunak
4
400
The Curious Case for Waylosing
cassininazir
1
480
Applied NLP in the Age of Generative AI
inesmontani
PRO
4
2.4k
Embracing the Ebb and Flow
colly
88
5.1k
Organizational Design Perspectives: An Ontology of Organizational Design Elements
kimpetersen
PRO
1
800
The Limits of Empathy - UXLibs8
cassininazir
1
610
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