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
Building well-defined APIs part 1: Proper HTTP
Search
Nikica Jokić
December 23, 2014
Technology
0
88
Building well-defined APIs part 1: Proper HTTP
Short intro to Ruby port of Webmachine.
Nikica Jokić
December 23, 2014
Tweet
Share
More Decks by Nikica Jokić
See All by Nikica Jokić
Aggregating data accountably and consistently
neektza
0
54
Other Decks in Technology
See All in Technology
United™️ Airlines®️ Customer®️ USA Contact Numbers: Complete 2025 Support Guide
flyunitedguide
0
780
Contributing to Rails? Start with the Gems You Already Use
yahonda
2
120
DBのスキルで生き残る技術 - AI時代におけるテーブル設計の勘所
soudai
PRO
55
22k
話題の MCP と巡る OCI RAG ソリューションの旅 - Select AI with RAG と Generative AI Agents ディープダイブ
oracle4engineer
PRO
5
110
Delta airlines®️ USA Contact Numbers: Complete 2025 Support Guide
airtravelguide
0
350
AIの全社活用を推進するための安全なレールを敷いた話
shoheimitani
2
640
スタックチャン家庭用アシスタントへの道
kanekoh
0
110
SEQUENCE object comparison - db tech showcase 2025 LT2
nori_shinoda
0
280
Rethinking Incident Response: Context-Aware AI in Practice
rrreeeyyy
1
390
CDKコード品質UP!ナイスな自作コンストラクタを作るための便利インターフェース
harukasakihara
2
200
IPA&AWSダブル全冠が明かす、人生を変えた勉強法のすべて
iwamot
PRO
2
220
Lakebaseを使ったAIエージェントを実装してみる
kameitomohiro
0
180
Featured
See All Featured
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
251
21k
Keith and Marios Guide to Fast Websites
keithpitt
411
22k
Music & Morning Musume
bryan
46
6.7k
XXLCSS - How to scale CSS and keep your sanity
sugarenia
248
1.3M
KATA
mclloyd
30
14k
Fashionably flexible responsive web design (full day workshop)
malarkey
407
66k
StorybookのUI Testing Handbookを読んだ
zakiyama
30
5.9k
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
47
9.6k
Connecting the Dots Between Site Speed, User Experience & Your Business [WebExpo 2025]
tammyeverts
7
330
[RailsConf 2023] Rails as a piece of cake
palkan
55
5.7k
Scaling GitHub
holman
460
140k
Code Reviewing Like a Champion
maltzj
524
40k
Transcript
Proper HTTP Building well-defined APIs, part 1: @neektza Nikica Jokić
HTTP is deceptively simple
• simple syntax, semantics up to you HTTP is deceptively
simple
• simple syntax, semantics up to you • easy to
build crappy, bad-behaving APIs HTTP is deceptively simple
• simple syntax, semantics up to you • easy to
build crappy, bad-behaving APIs • use error status codes HTTP is deceptively simple
• simple syntax, semantics up to you • easy to
build crappy, bad-behaving APIs • use error status codes • respect content-types (accept headers) HTTP is deceptively simple
• simple syntax, semantics up to you • easy to
build crappy, bad-behaving APIs • use error status codes • respect content-types (accept headers) • handle resource migration and locations HTTP is deceptively simple
A huge SVG! http://for-get.github.io/http-decision-diagram/httpdd.fsm.html
Webmachine (1/2)
• Not a framework - a toolkit Webmachine (1/2)
• Not a framework - a toolkit • Implements the
HTTP protocol as a state-machine Webmachine (1/2)
• Not a framework - a toolkit • Implements the
HTTP protocol as a state-machine Webmachine (1/2)
• Not a framework - a toolkit • Implements the
HTTP protocol as a state-machine Webmachine (1/2)
• Not a framework - a toolkit • Implements the
HTTP protocol as a state-machine • Several implementations: Webmachine (1/2)
• Not a framework - a toolkit • Implements the
HTTP protocol as a state-machine • Several implementations: • Webmachine (1st Erlang, then Ruby) Webmachine (1/2)
• Not a framework - a toolkit • Implements the
HTTP protocol as a state-machine • Several implementations: • Webmachine (1st Erlang, then Ruby) • Liberator (Clojure) Webmachine (1/2)
• Not a framework - a toolkit • Implements the
HTTP protocol as a state-machine • Several implementations: • Webmachine (1st Erlang, then Ruby) • Liberator (Clojure) • others? Webmachine (1/2)
A huge SVG! Again! http://for-get.github.io/http-decision-diagram/httpdd.fsm.html
Webmachine (2/2)
• Declarative Webmachine (2/2)
• Declarative Webmachine (2/2) get '/hello/:name' do "Hello #{params[:name]}!" end
• Declarative • Works by describing facts about the resource
Webmachine (2/2) get '/hello/:name' do "Hello #{params[:name]}!" end
• Declarative • Works by describing facts about the resource
Webmachine (2/2) get '/hello/:name' do "Hello #{params[:name]}!" end def resource_exists? resource end
• Declarative • Works by describing facts about the resource
Webmachine (2/2) get '/hello/:name' do "Hello #{params[:name]}!" end def resource_exists? resource end • known-method? / method-allowed ? • known-media-type? / media-type-available? • allowed? / authorised? • exists? / existed? • moved-temporarily? / moved-permanently?