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 Meetup #15
Search
Masato SERIZAWA
July 22, 2016
Technology
0
260
API Meetup #15
Open API Specification を使ったスマートな API 運用
Masato SERIZAWA
July 22, 2016
Tweet
Share
More Decks by Masato SERIZAWA
See All by Masato SERIZAWA
クラウド人事労務ソフトウェア開発の勘所
mserizawa
0
76
最高にモノづくりを楽しめる組織を目指して
mserizawa
5
2.1k
SmartHR における Authlete の活用
mserizawa
0
1.7k
SmartHR の開発現場最新事情 〜マイクロサービス始めました〜
mserizawa
5
3.5k
API Study #10
mserizawa
0
580
API Study #4
mserizawa
3
860
Other Decks in Technology
See All in Technology
統計データで2024年の クラウド・インフラ動向を眺める
ysknsid25
2
850
小学3年生夏休みの自由研究「夏休みに Copilot で遊んでみた」
taichinakamura
0
170
re:Invent をおうちで楽しんでみた ~CloudWatch のオブザーバビリティ機能がスゴい!/ Enjoyed AWS re:Invent from Home and CloudWatch Observability Feature is Amazing!
yuj1osm
0
130
Fanstaの1年を大解剖! 一人SREはどこまでできるのか!?
syossan27
2
170
DUSt3R, MASt3R, MASt3R-SfM にみる3D基盤モデル
spatial_ai_network
2
190
レンジャーシステムズ | 会社紹介(採用ピッチ)
rssytems
0
200
普通のエンジニアがLaravelコアチームメンバーになるまで
avosalmon
0
110
20241214_WACATE2024冬_テスト設計技法をチョット俯瞰してみよう
kzsuzuki
3
600
KubeCon NA 2024 Recap: How to Move from Ingress to Gateway API with Minimal Hassle
ysakotch
0
210
APIとはなにか
mikanichinose
0
100
生成AIのガバナンスの全体像と現実解
fnifni
1
190
Wantedly での Datadog 活用事例
bgpat
1
530
Featured
See All Featured
The Language of Interfaces
destraynor
154
24k
Git: the NoSQL Database
bkeepers
PRO
427
64k
Principles of Awesome APIs and How to Build Them.
keavy
126
17k
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
44
6.9k
Fight the Zombie Pattern Library - RWD Summit 2016
marcelosomers
232
17k
Fireside Chat
paigeccino
34
3.1k
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
356
29k
Into the Great Unknown - MozCon
thekraken
33
1.5k
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
47
5.1k
Building Better People: How to give real-time feedback that sticks.
wjessup
365
19k
Designing on Purpose - Digital PM Summit 2013
jponch
116
7k
Cheating the UX When There Is Nothing More to Optimize - PixelPioneers
stephaniewalter
280
13k
Transcript
© 2016 KUFU, Inc. 0QFO"1*4QFDJpDBUJPOΛͬͨ εϚʔτͳ"1*ӡ༻ גࣜձࣾ,6'6 ۔ᖒխਓ ݄
"1*.FFUVQ
© 2016 KUFU, Inc. ࣗݾհ ۔ᖒ խਓ @masato_serizawa •
גࣜձࣾ KUFU ΤϯδχΞ • ΤϯδχΞͱͯ͠ͷΩϟϦΞͷ΄ͱΜͲΛ WebAPI ͷઃܭɾ ։ൃɾӡ༻ɾൢചΛͯ͠ա͍ͯ͝͠·͢ • ͨ·ʹ Hackathon ʹग़ͨΓ͠·͢ • झຯ Data Visualization Ͱ͢
ຊ͓͢Δ͜ͱʰ8FC"1*༷ॻͷӡ༻ʱ
© 2016 KUFU, Inc. ΞδΣϯμ •͕ࠓ·ͰؔΘ͖ͬͯͨ WebAPI ͱͦͷ՝ •OpenAPI
Specification ͕ղܾͯ͘͠ΕΔ͜ͱ •OpenAPI Specification ͷ࣮ફ •·ͱΊ
͕ࠓ·ͰؔΘ͖ͬͯͨ 8FC"1*ͱͦͷ՝
© 2016 KUFU, Inc. WebAPI ͷӡ༻ʢ։ൃҎ֎ʣ •WebAPI ʹ I/F
༷ॻϦΫΤεταϯϓϧ ͕͖ͷͰ͢ •ઃܭɾ࣮ʹൺΔͱܰࢹ͞Ε͕ͪͰ͕͢ɺར ༻ऀͷ UX ʹେ͖͘ӨڹΛ༩͑Δ෦Ͱ͋Γ ·͢ •ͦΕΒʹ͍ͭͯɺաڈʹܞΘͬͨ WebAPI ͔Β ֶ͕Μͩ՝ཧ૾Λ͓͑͠·͢
$BTFᴈ໌ظͷ8FC"1*
© 2016 KUFU, Inc. Case1: ᴈ໌ظͷ WebAPI ػೳ εϙοτݕࡧɺॅॴݕࡧɺFUD
࣮ ॳ಄ ࣮ݴޠ +BWB ར༻ ϑϨʔϜϫʔΫ ಛʹͳ͠ Ϩεϙϯεܗࣜ 9.- *'༷ॻ 8PSE جຊεϖοΫ
© 2016 KUFU, Inc. Case1: ᴈ໌ظͷ WebAPI •ϦΫΤεταϯϓϧ͕๛ʹ͋ͬͨ •HTML
Ͱॻ͔Ε͍ͯͯɺϦϯΫΛԡ͢ͱϨεϙ ϯε͕֬ೝͰ͖Δ •ͲͷΑ͏ͳϦΫΤετύϥϝʔλ͕͋ͬͯɺͲ ͷΑ͏ͳϨεϙϯε͕͋Δͷ͔͕֬ೝ͍͢͠ •ͪΐͬͱͨ͠ςετπʔϧʹͳΔ (PPE
© 2016 KUFU, Inc. Case1: ᴈ໌ظͷ WebAPI •༷ॻ͕͋·Γӡ༻͞Ε͍ͯͳ͔ͬͨ •ࣾϑΝΠϧڞ༗αʔόͷͲ͔͜ʹ͋Δ
Word •هࡌͷൈ͚࿙Εཱ͕ͭ •࣮Λ֬ೝͨ͠ํ͕ૣ͍… •༷ͷ͍߹Θ͕ͤࡴ౸͢Δ 1SPCMFN
© 2016 KUFU, Inc. Case1: ᴈ໌ظͷ WebAPI •༷ॻ͕͔ͬ͠Γ͍ͯ͠ͳ͍ͱ։ൃίετ͚ͩ Ͱͳ͘ίϛϡχέʔγϣϯίετΕ্͕Δ
•ઃܭࢥͷෆ౷Ұى͖͍͢ •ʢΈԽ͠ͳ͍ͱʣਓ༷ॻΛඋ͠ͳ͍ •WebAPI ϒϥβ্ͰαΫͬͱϨεϙϯε νΣοΫͰ͖ΔͱḿΔ ֶ͕Μͩ͜ͱ
$BTFͪΐͬͱϞμϯͳ8FC"1*
© 2016 KUFU, Inc. Case2: ͪΐͬͱϞμϯͳ WebAPI ػೳ εϙοτݕࡧɺॅॴݕࡧɺFUD
ʢલड़"1*ͷϑϧεΫϥονϓϩμΫτʣ ࣮ ࠒ ࣮ݴޠ +BWB ར༻ ϑϨʔϜϫʔΫ 8"' Ϩεϙϯεܗࣜ +40/ *'༷ॻ 4QIJOY جຊεϖοΫ
© 2016 KUFU, Inc. Case2: ͪΐͬͱϞμϯͳ WebAPI •I/F ༷ॻΛ
Sphinx Ͱ࡞͍ͯͨ͠ •هड़ݴޠ rstʢreStructruedTextʣ •ιʔείʔυͱಉ͡ϦϙδτϦͰཧ •ϨϏϡʔରͱͳΔͨΊɺൈ͚࿙Ε͕গͳ͍ •HTML PDF ʹมͰ͖ΔଞɺσβΠϯબ ͯඒ͍͠υΩϡϝϯτʹ্͕Δ (PPE
© 2016 KUFU, Inc. Case2: ͪΐͬͱϞμϯͳ WebAPI •༷ॻͷӡ༻ίετ͕গͳ͔Β͔͔ͣͬͨ •ΤϯυϙΠϯτΛՃ͢Δ࣌ͳͲ݁ߏͳίϐ
ϖ࡞ۀ… •ϨεϙϯεαϯϓϧΛషΓ͚Δͷେม… •ΤϯλʔϓϥΠζ͚ʹผͰ༷ॻΛ༻ҙ͢Δ Α͏ͳ߹ɺΠν͔Βॻ͖͢ඞཁ͕͋ͬͨ 1SPCMFN
© 2016 KUFU, Inc. Case2: ͪΐͬͱϞμϯͳ WebAPI •៉ྷͳ༷ॻΛ࡞ΔͱتΕΔ •৺ͳ͔͍͠߹Θͤ༑తͳͷʹͳΔؾ͕
͢Δ •༷ॻͱιʔείʔυ͚ۙΕ͍ۙ΄Ͳྑ͍ •༷ॻ৭ʑͳϑΥʔϚοτͰͰ͖Δͱḿ Δ •༷ΛߏԽ͞ΕͨσʔλͰऔΕΔͱศརͦ͏ ֶ͕Μͩ͜ͱ
·ͱΊΔͱʜ
© 2016 KUFU, Inc. ·ͱΊ •ਓ༷ॻΛඋ͠ͳ͍ •ϨεϙϯενΣοΫ͕αΫͬͱग़དྷΔͱྑ͍ •៉ྷͳ༷ॻΛ࡞Δͱ͍߹Θͤίετ͕ݮΔ •༷ॻͱιʔείʔυ͚ۙΕ͍ۙ΄Ͳྑ͍
•༷ॻ༷ʑͳϑΥʔϚοτͰͰ͖Δͱྑ ͍ •༷ΛߏԽ͞ΕͨσʔλͰऔΕΔͱྑ͍
ҙ֎ͱߟྀ͕ଟ͍ʜʂ
0QFO"1*4QFDJpDBUJPO͕ ղܾͯ͘͠ΕΔ͜ͱ
© 2016 KUFU, Inc. ͓͞Β͍ •RESTful API Λهड़͢ΔͨΊͷ༷ •
͕ Λϕʔεʹࡦఆ 0QFO"1*4QFDJpDBUJPOͱ 4XBHHFS3&45GVM"1*هड़༷ͷ΄͔ ͍͔ͭ͘ͷπʔϧ܈ʹΑͬͯߏ͞Ε͍ͯ·͢
© 2016 KUFU, Inc. جૅࣝ 4XBHHFSͷߏ 4XBHHFS$PSF 8FC"1*ʹ࣮ʹଇͨ͠ 4XBHHFS4QFDΛฦ͢Τϯυ
ϙΠϯτΛੜ͢ϥΠϒϥϦ 4XBHHFS6* 4XBHHFS4QFDΛ͍͍ײ͡ʹ ϨϯμϦϯά͢Δ)5.- 4XBHHFS4QFD 4XBHHFSͷ༷ʹ४ͯ͡ 3&45"1*Λهड़ͨ͠ +40/:.- ੜ ಡΈࠐΈ 4XBHHFS&EJUPS ϒϥβ্Ͱ4XBHHFS4QFD Λهड़͢Δπʔϧ 3&45GVM"1* $MJFOU4%, ੜ
© 2016 KUFU, Inc. جૅࣝ 4XBHHFSͷߏ 4XBHHFS$PSF 8FC"1*ʹ࣮ʹଇͨ͠ 4XBHHFS4QFDΛฦ͢Τϯυ
ϙΠϯτΛੜ͢ϥΠϒϥϦ 4XBHHFS6* 4XBHHFS4QFDΛ͍͍ײ͡ʹ ϨϯμϦϯά͢Δ)5.- 4XBHHFS4QFD 4XBHHFSͷ༷ʹ४ͯ͡ 3&45"1*Λهड़ͨ͠ +40/:.- ੜ ಡΈࠐΈ 4XBHHFS&EJUPS ϒϥβ্Ͱ4XBHHFS4QFD Λهड़͢Δπʔϧ 3&45GVM"1* $MJFOU4%, ੜ 4XBHHFSͰ༷ॻΛੜ͢Δϑϩʔʹண͠·͢
© 2016 KUFU, Inc. Swagger Core + Swagger Spec
+ Swagger UI ಋೖͷεςοϓ 4UFQ 4XBHHFS$PSF ͷಋೖ 4UFQ 4XBHHFS4QFD ͷ֬ೝ 4UFQ 4XBHHFS6* ͷಋೖ w ϝδϟʔͳ8"'Ͱ͋ ΕϥΠϒϥϦ͕͋Γ ·͢ w +BWBͩͱΞϊςʔγϣ ϯɺ3VCZͩͱ%4-Ͱ "1*Λهड़͍͖ͯ͠· ͢ w 4XBHHFS4QFDΛऔಘ ͢ΔΤϯυϙΠϯτ͕ ੜ͑·͢ w )551(&5ͯ͠Ϩεϙ ϯεΛ֬ೝͯ͠Έ·͠ΐ ͏ w 4XBHHFS6*Λμϯ ϩʔυ༷ͯ͠ॻΛද ࣔͯ͠Έ·͠ΐ͏ w ϥΠϒϥϦʹΑͬͯ ༷ॻΛදࣔ͢ΔΤϯ υϙΠϯτΛੜ͢ ͷ͋Γ·͢
© 2016 KUFU, Inc. Swagger UI 4XBHHFS6*
© 2016 KUFU, Inc. Swagger UI •Ξϊςʔγϣϯ DSL Ͱهड़ͨ͠
API ͷઆ໌͕ ៉ྷʹϨϯμϦϯά͞Ε·͢ •ϥΠϒϥϦʹΑͬͯ Markdown Ͱॻ͘͜ͱ Մೳ •τʔΫϯೝূͷػߏඋΘ͍ͬͯ·͢ •ϦΫΤετύϥϝʔλͷઆ໌Λݟͳ͕Βɺ࣮ࡍ ʹΫΤϦΛߏஙͯ͠ϨεϙϯεΛ֬ೝͰ͖·͢
© 2016 KUFU, Inc. Swagger UI •Swagger UI γϯϓϧͳ
HTML5 ͳͷͰɺ Ϗϡʔൺֱత؆୯ʹΧελϚΠζՄೳͰ͢ •৭ຯͳͲΛௐͨ͠ςʔϚެ։͞Ε͍ͯ·͢
ࠓ·Ͱͷ՝ ͲͷΑ͏ʹղܾ͞ΕΔ͔
© 2016 KUFU, Inc. Swagger ͷಋೖʹΑΔ՝ղܾ ਓ༷ॻΛඋ͠ͳ͍ ࣮ʹଇ͢ΔͨΊ༰ ৗʹ࠷৽ͷঢ়ଶͱͳΔ
ϒϥβ্Ͱ ϨεϙϯενΣοΫΛ͍ͨ͠ 4XBHHFS6*্Ͱύϥϝʔλߏஙͱ ςετϦΫΤετ͕Մೳ ៉ྷͳ༷ॻΛ࡞Δͱ ͍߹Θͤίετ͕ݮΔ σϑΥϧτͰͦͦ͜͜៉ྷʹͳΔɻ ඞཁʹԠͯ͡ΧελϚΠζՄೳ ༷ॻͱιʔείʔυ ͚ۙΕ͍ۙ΄Ͳྑ͍ ιʔείʔυ্ʹهड़͞ΕΔ ༷ॻ༷ʑͳϑΥʔϚοτͰ Ͱ͖Δͱྑ͍ ͦͷؾʹͳΕ4XBHHFS4QFDΛ 1%'ͳͲมՄೳ ༷ΛߏԽ͞ΕͨσʔλͰ औಘͰ͖Δͱྑ͍ 4XBHHFS4QFDΛ )551ͰऔಘՄೳ
ͳΜ͔ͩͱͯྑͦ͞͏ʜ
0QFO"1*4QFDJpDBUJPOͷ࣮ફ
4NBSU)3"1*
© 2016 KUFU, Inc. SmartHR API ػೳ 4NBSU)3ैۀһใͷݕࡧ ࣮
࣮ݴޠ 3VCZ ར༻ ϑϨʔϜϫʔΫ (SBQF Ϩεϙϯεܗࣜ +40/ *'༷ॻ 4XBHHFS جຊεϖοΫ
© 2016 KUFU, Inc. SmartHR API •ઌʹ WebAPI Λ࣮ͯ͠ɺޙ͔Β
Swagger Spec Λੜ͢ΔΞϓϩʔνΛͱΓ·ͨ͠ •શʹ RESTful ͳઃܭͰɺτʔΫϯೝূ͋Γ ·͢ •Swagger UI ͔ͳΓΧελϚΠζͯ͋͠Γ·͢
© 2016 KUFU, Inc. SmartHR API 4XBHHFS$PSF
© 2016 KUFU, Inc. SmartHR API 4XBHHFS4QFD
© 2016 KUFU, Inc. SmartHR API 4XBHHFS6*
ͳ͔ͳ͔ྑ্͍͕Γʂ ӡ༻ίετؾʹͳΒͳ͍
·ͱΊ
© 2016 KUFU, Inc. ·ͱΊ •OpenAPI Specification Λར༻͢Δͱίετ Ͱ͖ͪΜͱ༷ͨ͠ॻ͕࡞ΕΔ
•ϦΫΤετνΣοΫπʔϧͱͯ͑͠Δ •༰͕Խ͢ΔϦεΫ͍ •ར༻͍ͯ͠Δ WAF ʹରԠ͢ΔϥΠϒϥϦ͕͋ Εಋೖൺֱత؆୯
0QFO"1*4QFDJpDBUJPOͰ εϚʔτʹ"1*Λӡ༻͠·͠ΐ͏ʂ
ΤϯδχΞืूͯ͠·͢ ࠙ձͰ͓͠·͠ΐ͏ʂCFFST w3VCZPO3BJMT w#͚4BB4 wݹͯ͘ڊେͳ੍Λ)BDL͍ͨ͠ w4NBSU)3"1*Λӡ༻͍ͨ͠