Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
ASP.NetでAPIを作ってみた
Search
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
laco
January 22, 2014
Programming
520
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
ASP.NetでAPIを作ってみた
C#福岡 第三回勉強会にて
API.Net WebAPIの話
laco
January 22, 2014
More Decks by laco
See All by laco
Angular2とMVVM
laco0416
5
5.7k
Pub使ってますか?
laco0416
1
1.7k
OSC_F_2013 LT
laco0416
0
150
Other Decks in Programming
See All in Programming
Workers Cache を知る
syumai
0
360
[Rails World 2026] Durable orchestration on Rails: from continuation to workflow
palkan
1
740
Railsバージョンを4倍にした話
optim
0
290
AWS CDKのカスタムリソースでContinuum(旧Security Agent)を実装した話 | Implementing Continuum (formerly Security Agent) via AWS CDK Custom Resource
akihisaikeda
2
150
Augmenting AI with the Power of Jakarta EE
ivargrimstad
0
150
The Rails Doctrine Decade
koic
2
570
ActionController meets Protocol Buffers
sorah
0
430
Optunaを作ったときにやりたかったこと、その後 (2026/10/16, Optuna Meetup #3)
iwiwi
1
400
IBM Bob Dojo #1 仕様駆動開発入門
oniak3ibm
PRO
0
390
[2026-09-26]空論ジェネリックプロセス~テスト資産とAIで紡ぐ、再現可能なパフォーマンスチューニングの話~
tosite
0
270
AI主導のプログラミング学習アプリを作ってみた
econanringo
0
180
wkhtmltopdfの次どうするか問題2026
willnet
2
1.9k
Featured
See All Featured
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
141
35k
Abbi's Birthday
coloredviolet
4
10k
Neural Spatial Audio Processing for Sound Field Analysis and Control
skoyamalab
0
560
The Straight Up "How To Draw Better" Workshop
denniskardys
239
140k
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
52
6.1k
Stewardship and Sustainability of Urban and Community Forests
pwiseman
0
550
Jess Joyce - The Pitfalls of Following Frameworks
techseoconnect
PRO
1
450
The Mindset for Success: Future Career Progression
greggifford
PRO
0
540
Site-Speed That Sticks
csswizardry
13
1.6k
Leading Effective Engineering Teams in the AI Era
addyosmani
9
2.7k
Leveraging LLMs for student feedback in introductory data science courses - posit::conf(2025)
minecr
1
430
Building Applications with DynamoDB
mza
96
7.2k
Transcript
ASP.NetでAPIを作ってみた 2014.01/22 C#福岡 第3回勉強会
About me
らこ Suguru Inatomi Twitter:@laco0416 学生 C#とかJavaとかPythonとか http://lacolaco.net
What ‘s ASP.Net Web API?
One ASP.NET (Scott Hanselman氏のブログより)
Microsoft ASP.NET Web API 現行バージョン: 4.0.30506 マルチプラットフォームのHTTPサービスフレームワーク 2012年8月に誕生したばかりの新しい技術 なんと20日にWeb API
2.1リリース http://blogs.msdn.com/b/webdev/archive/2014/01/20/announcing-the- release-of-asp-net-mvc-5-1-asp-net-web-api-2-1-and-asp-net-web- pages-3-1.aspx
ASP.NET Web API (@ITより)
Let’s make it!
Step-1 Make Project
None
None
Step-2 Make Controller
ModelsController Controller class -> ValuesController API endpoint -> http://lacolaco.net/api/values コントローラ名からURLルーティングを
自動でやってくれる
None
None
これだけですでに実行可能 RESTfulなインタフェースが すでに定義済み いたれりつくせり
メソッド名とHTTPのメソッド が対応しているので 名前の変更はNG 使わないAPIを消すのはOK
Step-3 Receive params
引数無しGet 主にデータストアから 全レコードを返す時など。
引数の規則 ・プリミティブ型はUriから ・それ以外はBodyから ・[FromBody]をつけると プリミティブでもBodyから読む ・[FromUri]をつけると オブジェクトでもUriから読む
Uriパラメータ受け取り ・仮引数名がそのままkeyになる api/samples?id=1 ・引数がidだけの時は api/samples/1と api/samples?id=1 は同じ
None
Bodyパラメータ受け取り ・Bodyから受け取れるのは 1つの引数のみ ・モデルクラスを用意して jsonのオブジェクトを受け取る ことができる
Body { id : 0 , value : “CSharp”} ↓
C# new Sample() { id = 0, value = “CSharp”};
Step-4 Run
None
API仕様のページまで 作ってくれる
My product IT Event API
直近1ヶ月のIT系勉強会を返すAPI 文字列で検索も可能 http://api.lacolaco.net/events?query=福岡
ここで終わりだったんですが
Web API 2.1リリース ASP.Net MVC 5.1とWeb API 2.1が同時に正式リリース。 VS 2013
VS 2013 Update 1へのアプデが必要 VS 2012 ASP.NET and Web Tools 2013.1 for Visual Studio 2012の インストールが必要
Web API 2 : VS2013でのみ利用可能だった ↓ Web API 2.1 :
VS2012でも利用可能に。 Install-Package Microsoft.AspNet.WebApi -Version 5.1.0 ・ Global Error Handling (エラーハンドリングを一箇所にまとめられるようになった) ・ Attribute Routing Improvements (属性によるルーティングの改善?) ・ Help Page Improvements (APIヘルプページの改善) ・ IgnoreRoute Support ・ BSON Media-Type Formatter (BSONオブジェクトに対応) ・ Better Support for Async Filters ・ Query Parsing for the Client Formatting Library (System.Net.Http.Formattingの拡張) まだ詳細を把握できていないので詳しくは原文を参照してください http://www.asp.net/web-api/overview/releases/whats-new-in-aspnet-web-api-21
Thank you for listening