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
api-design-practice.pdf
Search
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
to4iki
September 07, 2014
Programming
36
0
Share
api-design-practice.pdf
to4iki
September 07, 2014
More Decks by to4iki
See All by to4iki
Claude Code の活用事例
to4iki
0
170
Swift Concurrencyを利用したUIViewController表示の排他制御の実装
to4iki
0
3.7k
ケースに応じたUICollectionViewのレイアウト実装パターン
to4iki
1
5.6k
ビューインプレッションの計測方法
to4iki
1
1.1k
秘伝の `gitconfig`
to4iki
1
460
Abema iOS Architecture
to4iki
12
3.5k
timetable-bot
to4iki
0
15k
BLoC Pattern Introduction with Swift
to4iki
2
1.4k
nel
to4iki
0
190
Other Decks in Programming
See All in Programming
SPMマルチモジュールで テストカバレッジを取得する技法
yosshi4486
0
110
RailsTokyo 2026#4: AI様があれば、 Hotwireの弱点は消えるか?
naofumi
4
510
Spec-Driven Development with AI-Agents: From High-Level Requirements to Working Software
antonarhipov
2
300
プロパティの順序で型推論が壊れる!? TypeScript6.0の修正からContext-Sensitivityの仕組みを追う
bicstone
2
910
AIエージェントの隔離技術の徹底比較
kawayu
0
420
色即是空、空即是色、データサイエンス
kamoneggi
1
150
tsserverとは何だったのか、これからどうなるのか
nowaki28
1
350
~ 秘伝のタレ化した『神スプシ』と戦う ~ 関数型パラダイムで壊れない仕組みへ
h0r15h0
1
120
UaaL×Androidアプリのメモリ計測 — Memory Profilerの先へ
rio432
0
170
Skillは並べた。動かなかった。契約で繋いだ。— 65個のSkillから、自走する開発サイクルへ
junholee
0
700
TypeSpec で繋ぐ複数プロダクトの型安全
maroon8021
1
210
Swiftのレキシカルスコープ管理
kntkymt
0
180
Featured
See All Featured
How to audit for AI Accessibility on your Front & Back End
davetheseo
0
380
Jamie Indigo - Trashchat’s Guide to Black Boxes: Technical SEO Tactics for LLMs
techseoconnect
PRO
0
140
From Legacy to Launchpad: Building Startup-Ready Communities
dugsong
0
210
Designing Experiences People Love
moore
143
24k
Mind Mapping
helmedeiros
PRO
1
200
Effective software design: The role of men in debugging patriarchy in IT @ Voxxed Days AMS
baasie
0
360
Mozcon NYC 2025: Stop Losing SEO Traffic
samtorres
0
230
The B2B funnel & how to create a winning content strategy
katarinadahlin
PRO
1
360
Agile Actions for Facilitating Distributed Teams - ADO2019
mkilby
0
190
The Director’s Chair: Orchestrating AI for Truly Effective Learning
tmiket
1
170
Building Experiences: Design Systems, User Experience, and Full Site Editing
marktimemedia
0
510
The Language of Interfaces
destraynor
162
26k
Transcript
API ઃܭͰҙ͍ͯ͠Δࣄ toshiki takezawa @to4iki
None
ࠓ͔Βͷ༰ ͋͘·Ͱ։ൃऀࢹͰ͢ APIΛ࡞ΔࢹͰ
લఏ REST ~.pl ~.do ~servletͱ͔ ಛఆݴޠʹґଘ͍ͯ͠Δ͔ΒγεςϜมߋ͠ ʹ͍͘ɻ FW(struts → rails)ͱ͔ม͑ͨΒURLมΘΔ
ΑͶ ! ɾwebΛࢧ͑Δٕज़ಡ͏
1. ಈࢺͰͳ໊͘ࢺ ɾϦιʔεΛ໊ࢺͰද͢ collectionͰ υϝΠϯʹΑͬͯಈࢺ͋Γ /convert?from=EUR&to=CNY&amount=100` ɾHTTP ϝιουΛϦιʔεͷૢ࡞ͱ͢Δ get, post,
put, delete ɾ֊ͳΔ͚ͩઙ͘อͭɺγϯϓϧʹ /users/5678/dogs /resource/identifier/resource ͕҆ ɾURLʹϝιουΛؚΊͳ͍ /users/show/123ͱ͔ → /users/123 ɾෳࡶ͞ΫΤϦύϥϝʔλʹԡ͠ࠐΉ /users?q=hoge&offset=50&limit=30
2. ΤϥʔϋϯυϦϯά ɾεςʔλείʔυΛదʹ༻͢Δ 200: success 400൪: client error 404: not
found 409 conflict 500: server error
3. όʔδϣχϯά ɾAPI ͷϨεϙϯεΛϋϯυϧͯ͠ϩδοΫ͕มΘΔ ߹, URL ʹ͍ΕΔ ͔ͯɺೖΕͳ͍ͱޓੑͬͨมߋ͘Θ͑ͨͱ͖ࢮ ͵ /api/1.0/dogs
/api/1.1/dogs ! AcceptsϔομʔͰόʔδϣχϯάͯ͠
4. ϦιʔεͷUUIDΛఏڙ͢Δ “uuid":"39D3FA7E-‐29F5-‐4406-‐9B54-‐AE70FA3CBF87" ! sequenceͰ͍͍ͱࢥ͏͚Ͳ ! mysqlͳΒ SELECT UUID()
AS u ! postgreσϑΥϧτରԠͯ͠ͳ͍͔Β uuid-ossp͍ΕͯͶ
5. ϦιʔεͷtimestampΛఏڙ͢Δ { "createTime":1406391453253, "modifyTime":1406421657000
}
6. ֎෦Ωʔͷࢀষωετ͢Δ "name":"fute", "ownerId": “13524-‐...", !
Ͱͳ͘ ! "name":"fute", "owner": { "id": "13524-‐...", } ϨεϙϯεͷߏΛมߋͨ͠ΓɺτοϓϨϕϧͷϑΟʔ ϧυΛՃ͢Δࣄͳ͘ɺؔ࿈ใΛؚΊΔࣄ͕Ͱ͖Δ
7. Ϧιʔεࢀরͷalias༻ҙ͠ͱ͘ ɾid /users/:id ɾname /users/:name ɾmail /users/:mail
ଞʹ ɾAPIΞΫηεSSLඞਢʹ͍͔ͨ͠ ɾdocumentॆ࣮ͤ͞Α͏ ɾEtagͰΩϟογϡαϙʔτͱ͔ (ΫϥΠΞϯτͷif-none-matchϔομͰ cache࠷৽͔νΣοΫͱ͔)
͓ΘΓ