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
83
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
51
Other Decks in Technology
See All in Technology
DataOps実現への道筋 持続可能な運用体制の構築 / journey-to-dataops
pei0804
4
880
[DigDAOマッチングドネーション] Fund distribution experiment for Civictech projects via Quadratic Funding
tkgshn
0
580
巨大インフラ産業で戦うSRE / SRE working in the large infrastructure industry
m_norii
1
1.1k
從大學到出社會,這十年的參與和維護的開源專案
tjjh89017
0
520
oxc は次世代のJSツールチェイン開発基盤になり得るか
re_taro
4
1.2k
データ品質管理の第一歩
nayuts
1
240
アンドパッドのマルチプロダクト戦略を支えるSRE / SRE NEXT 2024
cassius7
0
830
プロダクトエンジニアを支える組織アーキテクチャ
niwatakeru
4
380
Kaggleで賞金200万円ゲットした話 〜 Machine Unlearning と Google AI Assistants 〜
toshi_k_datasci
2
600
Enabling SRE by Guide Maps/srenext2024
nikkei_engineer_recruiting
1
440
20240726 生成AI Conf 第7回勉強会 - MNTSQ紹介資料
mntsq
0
300
OneNote よりも Loop を使って業務の生産性を爆上げするためにあれこれ使ってみた件
mappie_kochi
0
400
Featured
See All Featured
For a Future-Friendly Web
brad_frost
173
9.2k
Done Done
chrislema
179
15k
Building Adaptive Systems
keathley
35
2.1k
How GitHub Uses GitHub to Build GitHub
holman
471
290k
Fantastic passwords and where to find them - at NoRuKo
philnash
45
2.7k
Building Effective Engineering Teams - LeadDev
addyosmani
53
2.3k
Building Your Own Lightsaber
phodgson
101
5.9k
Building a Modern Day E-commerce SEO Strategy
aleyda
32
6.7k
Easily Structure & Communicate Ideas using Wireframe
afnizarnur
189
16k
VelocityConf: Rendering Performance Case Studies
addyosmani
321
23k
Making the Leap to Tech Lead
cromwellryan
128
8.7k
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
29
2.5k
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?