Lock in $30 Savings on PRO—Offer Ends Soon! ⏳
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
api-design-practice.pdf
Search
to4iki
September 07, 2014
Programming
0
35
api-design-practice.pdf
to4iki
September 07, 2014
Tweet
Share
More Decks by to4iki
See All by to4iki
Claude Code の活用事例
to4iki
0
130
Swift Concurrencyを利用したUIViewController表示の排他制御の実装
to4iki
0
3.5k
ケースに応じたUICollectionViewのレイアウト実装パターン
to4iki
1
5.1k
ビューインプレッションの計測方法
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.3k
nel
to4iki
0
160
Other Decks in Programming
See All in Programming
Integrating WordPress and Symfony
alexandresalome
0
160
Claude Codeの「Compacting Conversation」を体感50%減! CLAUDE.md + 8 Skills で挑むコンテキスト管理術
kmurahama
1
370
AIコーディングエージェント(skywork)
kondai24
0
180
C-Shared Buildで突破するAI Agent バックテストの壁
po3rin
0
390
実は歴史的なアップデートだと思う AWS Interconnect - multicloud
maroon1st
0
210
AIエージェントの設計で注意するべきポイント6選
har1101
4
310
愛される翻訳の秘訣
kishikawakatsumi
3
330
Developing static sites with Ruby
okuramasafumi
0
310
開発に寄りそう自動テストの実現
goyoki
2
1.1k
Giselleで作るAI QAアシスタント 〜 Pull Requestレビューに継続的QAを
codenote
0
230
20251212 AI 時代的 Legacy Code 營救術 2025 WebConf
mouson
0
190
TUIライブラリつくってみた / i-just-make-TUI-library
kazto
1
390
Featured
See All Featured
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
46
2.6k
Bootstrapping a Software Product
garrettdimon
PRO
307
120k
Mobile First: as difficult as doing things right
swwweet
225
10k
Automating Front-end Workflow
addyosmani
1371
200k
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
48
9.8k
Designing for Performance
lara
610
69k
[SF Ruby Conf 2025] Rails X
palkan
0
540
[RailsConf 2023] Rails as a piece of cake
palkan
58
6.2k
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
37
6.2k
No one is an island. Learnings from fostering a developers community.
thoeni
21
3.6k
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
31
2.6k
Designing Dashboards & Data Visualisations in Web Apps
destraynor
231
54k
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࠷৽͔νΣοΫͱ͔)
͓ΘΓ