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
340
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
750
私の生活を変えたHeadless Chrome / Headless Chrome who changed my life
taminif
3
480
WebSocketをiOSに持ち込んで辛い思いをした経験がありますか!? / have you painful experience in web socket?
taminif
3
5.7k
LINEで馬券を購入する / Purchase a betting ticket at LINE
taminif
1
1.6k
SkyWayで一年間運用してきたけどWebRTCってつらいんじゃないの
taminif
2
990
オンライン英会話とSkyWay
taminif
0
500
オンライン英会話アプリとSkyWay
taminif
0
450
Mac1台でアプリを作る時代再び
taminif
0
420
Other Decks in Programming
See All in Programming
RubyKaigi Hack Space in Tokyo & 函館最速 "予習" 会 / RubyKaigi Hack Space in Tokyo & The Fastest Briefing of RubyKaigi 2026 in Hakodate
moznion
1
130
TypeScript LSP の今までとこれから
quramy
0
120
Language Server と喋ろう – TSKaigi 2025
pizzacat83
2
740
TypeScript製IaCツールのAWS CDKが様々な言語で実装できる理由 ~他言語変換の仕組み~ / cdk-language-transformation
gotok365
7
380
DevDay2025-OracleDatabase-kernel-addressing-history
oracle4engineer
PRO
7
1.6k
Efficiency and Rock 'n’ Roll (Really!)
hollycummins
0
600
Spring gRPC で始める gRPC 入門 / Introduction to gRPC with Spring gRPC
mackey0225
0
160
TypeScript だけを書いて Tauri でデスクトップアプリを作ろう / Tauri with only TypeScript
tris5572
2
540
List Unfolding - 'unfold' as the Computational Dual of 'fold', and how 'unfold' relates to 'iterate'"
philipschwarz
PRO
0
140
Zennの運営完全に理解した #完全に理解したTalk
wadayusuke
1
140
Devinで実践する!AIエージェントと協働する開発組織の作り方
masahiro_nishimi
6
2.6k
ワイがおすすめする新潟の食 / 20250530phpconf-niigata-eve
kasacchiful
0
260
Featured
See All Featured
Imperfection Machines: The Place of Print at Facebook
scottboms
267
13k
Designing for humans not robots
tammielis
253
25k
Embracing the Ebb and Flow
colly
85
4.7k
Why You Should Never Use an ORM
jnunemaker
PRO
56
9.4k
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
129
19k
Java REST API Framework Comparison - PWX 2021
mraible
31
8.6k
Facilitating Awesome Meetings
lara
54
6.4k
The Cost Of JavaScript in 2023
addyosmani
49
8.1k
The MySQL Ecosystem @ GitHub 2015
samlambert
251
12k
The World Runs on Bad Software
bkeepers
PRO
68
11k
How to train your dragon (web standard)
notwaldorf
92
6k
Site-Speed That Sticks
csswizardry
7
590
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/
͋Γ͕ͱ͏͍͟͝·ͨ͠