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
250
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.4k
API Study #10
mserizawa
0
570
API Study #4
mserizawa
3
850
Other Decks in Technology
See All in Technology
Amazon CloudWatch Network Monitor のススメ
yuki_ink
1
200
ExaDB-D dbaascli で出来ること
oracle4engineer
PRO
0
3.8k
Terraform Stacks入門 #HashiTalks
msato
0
350
IBC 2024 動画技術関連レポート / IBC 2024 Report
cyberagentdevelopers
PRO
0
110
Engineer Career Talk
lycorp_recruit_jp
0
140
iOS/Androidで同じUI体験をネ イティブで作成する際に気をつ けたい落とし穴
fumiyasac0921
1
110
SSMRunbook作成の勘所_20241120
koichiotomo
2
130
スクラムチームを立ち上げる〜チーム開発で得られたもの・得られなかったもの〜
ohnoeight
2
350
20241120_JAWS_東京_ランチタイムLT#17_AWS認定全冠の先へ
tsumita
2
250
オープンソースAIとは何か? --「オープンソースAIの定義 v1.0」詳細解説
shujisado
7
760
Adopting Jetpack Compose in Your Existing Project - GDG DevFest Bangkok 2024
akexorcist
0
100
Exadata Database Service on Dedicated Infrastructure(ExaDB-D) UI スクリーン・キャプチャ集
oracle4engineer
PRO
2
3.2k
Featured
See All Featured
It's Worth the Effort
3n
183
27k
Writing Fast Ruby
sferik
627
61k
How to train your dragon (web standard)
notwaldorf
88
5.7k
Gamification - CAS2011
davidbonilla
80
5k
Build your cross-platform service in a week with App Engine
jlugia
229
18k
Fashionably flexible responsive web design (full day workshop)
malarkey
405
65k
Mobile First: as difficult as doing things right
swwweet
222
8.9k
Speed Design
sergeychernyshev
24
610
The Invisible Side of Design
smashingmag
298
50k
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
33
1.9k
Bootstrapping a Software Product
garrettdimon
PRO
305
110k
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
16
2.1k
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*Λӡ༻͍ͨ͠