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
Web APIを理解する
Search
taminif
July 15, 2017
Programming
0
320
Web APIを理解する
php conference Kansai 2017
本編LT枠
taminif
July 15, 2017
Tweet
Share
More Decks by taminif
See All by taminif
PuppeteerとPlaywrightの15日間の演劇 / relation of Puppeteer and Playwright
taminif
3
2.1k
Redashの開発はじめました / How to get started Redash development
taminif
0
730
私の生活を変えたHeadless Chrome / Headless Chrome who changed my life
taminif
3
450
WebSocketをiOSに持ち込んで辛い思いをした経験がありますか!? / have you painful experience in web socket?
taminif
3
5.5k
LINEで馬券を購入する / Purchase a betting ticket at LINE
taminif
1
1.5k
SkyWayで一年間運用してきたけどWebRTCってつらいんじゃないの
taminif
2
970
オンライン英会話とSkyWay
taminif
0
480
オンライン英会話アプリとSkyWay
taminif
0
420
Mac1台でアプリを作る時代再び
taminif
0
410
Other Decks in Programming
See All in Programming
AIの力でお手軽Chrome拡張機能作り
taiseiue
0
170
Amazon Q Developer Proで効率化するAPI開発入門
seike460
PRO
0
110
コミュニティ駆動 AWS CDK ライブラリ「Open Constructs Library」 / community-cdk-library
gotok365
2
140
Flutter × Firebase Genkit で加速する生成 AI アプリ開発
coborinai
0
160
CDK開発におけるコーディング規約の運用
yamanashi_ren01
2
130
ファインディの テックブログ爆誕までの軌跡
starfish719
2
1.1k
GAEログのコスト削減
mot_techtalk
0
120
負債になりにくいCSSをデザイナとつくるには?
fsubal
10
2.4k
Amazon Bedrock Multi Agentsを試してきた
tm2
1
290
SwiftUIで単方向アーキテクチャを導入して得られた成果
takuyaosawa
0
270
データの整合性を保つ非同期処理アーキテクチャパターン / Async Architecture Patterns
mokuo
47
17k
Multi Step Form, Decentralized Autonomous Organization
pumpkiinbell
1
750
Featured
See All Featured
Art, The Web, and Tiny UX
lynnandtonic
298
20k
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
21
2.5k
Being A Developer After 40
akosma
89
590k
The Art of Delivering Value - GDevCon NA Keynote
reverentgeek
10
1.3k
Practical Tips for Bootstrapping Information Extraction Pipelines
honnibal
PRO
12
960
Documentation Writing (for coders)
carmenintech
67
4.6k
The Psychology of Web Performance [Beyond Tellerrand 2023]
tammyeverts
46
2.3k
GraphQLの誤解/rethinking-graphql
sonatard
68
10k
What's in a price? How to price your products and services
michaelherold
244
12k
Code Review Best Practice
trishagee
67
18k
For a Future-Friendly Web
brad_frost
176
9.5k
The Art of Programming - Codeland 2020
erikaheidi
53
13k
Transcript
Web APIΛཧղ͢Δ php conference Kansai 2017 ຊฤLT 2017/07/15 େౡ ޫو@sbntaminif
ࣗݾհ • ΣϒϦΦגࣜձࣾWEBΤϯδχΞ • ීஈژͰಇ͍͍ͯ·͢ • ඈͼೖΓࢀՃͱ͍͏͜ͱͰ ٸᬎ͜ͷϓϨθϯΛ࡞Γ·ͨ͠ʂ
Web APIͷઆ໌
௨ৗͷHTTP௨৴ ϒϥβ 1)1αʔόʔ ϦΫΤετ )5.-
APIͷHTTP௨৴ ϒϥβ 1)1αʔόʔ ϦΫΤετ Կ͔͠Βͷ
ͬͯΔ͜ͱ ಉ͡Ͱ͢ʂ
ϒϥβ͕ཧղ͢Δඞཁ͕ ͳ͍ͷͰɺʢ࣮࣭ʣͲΜͳ Ͱฦͤ·͢ɻ
Ͳ͏͍͏࣌ʹ༻͢Δͷ͔
APIͷ༻్ • APIલఏͷγεςϜઃܭ࣌ • ΞϓϦͰใΛऔಘ͢Δ࣌ • ୈࡾऀʹใΛఏڙ͢Δ࣌
REST APIͱ͍͏ ߟ͑ํ
REST APIͱ • ιϑτΣΞΞʔΩςΫνϟͷҰͭ Web APIͰଟ͘࠾༻͞Ε͍ͯΔ • URLHTTP ϝιουͳͲWebͷ੍ʹैΘͤΔ͜ ͱͰڞ௨ཧղΛ࣋ͭ
• TwitterGithubͷAPI RESTͷਪʹैͬͯఏڙ͞Ε͍ͯΔ
αϯϓϧʢGitHub APIʣΛͬͯઆ໌ https://api.github.com/repos ->GETͰΞΫηε->ϨϙδτϦҰཡΛऔಘ ->POSTͰΞΫηε->ϨϙδτϦΛՃ “repos”(ϦϙδτϦ)ͱ͍͏ϦιʔεΛ ૢ࡞͢ΔAPIͱͳΔ ΤϯυϙΠϯτ Ϧιʔε
REST APIͷਪ࣮ ʢϝιουʣ • GETऔಘ • POSTՃ • PUTมߋ •
DELETEআ
REST APIͷਪ࣮ ʢϝιουʣ • GETऔಘ -> R(Read) • POSTՃ ->
C(Create) • PUTߋ৽ -> U(Update) • DELETEআ -> D(Delete) ->σʔλʢϦιʔεʣʹରͯ͠ૢ࡞
REST APIͷਪ࣮ʢURLʣ • Ϧιʔε෦తޠͷෳܗ • usersʢձһʣ • tagsʢλάʣ • Ͱ͖Δ͚ͩ͘ɺར༻ऀʹΘ͔Γ໊͍͢
લΛ͚ͭΔ
REST APIͷਪ࣮ ʢHTTP Responseͦͷ1ʣ • 200൪ΞΫηεʹޭͨ͠߹ʹฦ͢ • 200OK 201Created
REST APIͷਪ࣮ ʢHTTP Responseͦͷ2ʣ • 400൪ΫϥΠΞϯτʹ͕͋Δ߹ʹฦ͢ • 401ೝূ͕ඞཁͳURL 404ͦͦଘࡏ͠ͳ͍URL •
500൪αʔόʹ͕͋Δ߹ʹฦ͢
REST APIʹैࣄ͢Δ͜ͱͰ Θ͔Γ͍͢APIΛ ઃܭ͠·͠ΐ͏
ࢀߟɿWeb API The Good Parts https://www.amazon.co.jp/exec/obidos/ASIN/4873116864/
͋Γ͕ͱ͏͍͟͝·ͨ͠