SlideShare a Scribd company logo
1 of 24
Download to read offline
Razvoj REST API-ja za Windows Azure
koristeći ASP.NET Web API
Radenko Zec, Lanaco d.o.o
October 24rd, 2012
Cilj prezentacije
• napraviti “Real World” Web API koristeći
ASP.NET Web API
Šta je REST ?
• to je stil softverske arhitekture, za distribuirane
hypermedia sisteme kao što je „World Wide Web“
• nije protokol ni standard
Šta je ASP.NET Web API ?
• Frejmvork koji omogućava lak razvoj HTTP
servisa kojima se može pristupati sa velikog
broja različitih klijenata uključujući browsere i
mobilne uređaje
Da li je ASP.NET Web API =
RESTful service?
• ASP.NET Web API ne diktira stil arhitekture
• ali vi možete da razvijete RESTful service
pomoću ASP.NET Web API- ja
Richardson-ov model zrelosti
REST-a
Zašto Web API ?
+
Skaliranje u oblaku
Koje metode ASP.NET Web API
podržava
Metod Akcija HTTPMetod Relativni URI
Get Vraća listu svih
kontakata
GET /api/contacts
Get Vraća kontakt na
osnovu id-a
GET /api/contacts/id
Add Dodaje novi
kontakt
POST /api/contacts
Update Mijenja selektovani
kontakt
PUT /api/contacts
Delete Briše kontakt DELETE /api/contacts/id
Rast Web API-ja
Kako implementirati Web API
• Nasljediti klasu ApiController
• Implementirati akcije
– akcije se mapiraju na HTTP metode
– stavite prefix ispred metoda za željeni HTTP method
(PostCustomer)
DEMO
Action parameters
• prosti tipovi se dobijaju iz URI-ja
– route data, query parameters
http://api.mssinergija.net/kontakt?kod=nesto
• kompleksni tipovi – request body
– MediaTypeFormatters koriste se za deserijalizaciju
Request Body-ja zavisno od content type-a
– JSON i XML su podržani pod default-u
Validacija
• Validacija se vrši na podacima prilikom svakog
request-a
• greške prilikom validacije se snimaju u
ModelState
• provjerite ModelState.IsValid
Filteri
• Tipovi filtera :
– Action filters (pokreću se prije i nakon poziva akcije)
– Authorization filters (pokreću se prije model binding-a i
služe za autorizaciju korisnika)
– Exception filters (generišu odgovor u slučaju greške na
centralizovan način)
• Oni mogu biti konfigurisani globalno, po
kontroleru i po akciji
HTTP Dispatcher
Invoke Action
Action filters
Model Bind
Select action Exception filters
Route to controller Formatting
Request Response
Authorization filters
Opis Web API-ja
• koristi se IApiExplorer servis da bi se dobio
runtime opis Web API-ja
• korisno prilikom izrade help stranica, test
klijenata, alata i sl.
• http://nuget.org/packages/Microsoft.AspNet.Web
Api.HelpPage
IApiExplorer
public ActionResult Index()
{
var apiExplorer =
GlobalConfiguration.Configuration.Services.
GetApiExplorer();
return View(apiExplorer);
}
Hosting
• dva načina hostovanja
– ASP.NET Web Application (IIS)
– Self-host (npr. console application, Windows service,
Azure Worker Role, itd.)
• hostovanje u memoriji je korisno za integration
testiranje servisa
DEMO
http://blog.developers.ba
@radenkozec
Hvala na pažnji.
Help us choose the best Sinergija lecturer! HTC and Microsoft will award you
– at the conference end, we’ll give one HTC Windows Phone 8X to someone
from the audience – randomly.
Go to www.mssinergija.net, log in and cast your votes!
You can rate only lectures that you were present at, just once. More lectures you rate, more chances you have.
Please use computers at the front of this room, or rate lecture from your phone or home computer, at Sinergija portal.
This prize contest will end at Thursday, October 24th at 21:00. Winner will be announced at the official Sinergija web portal,
www.mssinergija.net
Please rate this lecture
and WIN Windows Phone 8X by
HTC!
Powered by:
Microsoft and
Open Source
gateway for deeper
exploration of
open source
engagements
http://www.microsoft.com
/openness
Port25
blogs from the
platform
community and
the OSS Lab
teams
http://Port25.technet.com
Codeplex
resources for
developers and
consumers of
open source
projects
http://www.codeplex.com
Interoperability
Bridges
technical collaborative
works
http://www.interoperabilit
ybridges.com
Open Up
cross-Industry
Interoperability
and Standards
activities
http://www.microsoft.com
/interop/openup
Shared Source
portal for
programmaticall
y sharing code
http://www.microsoft.com
/sharedsource
OData
open source starter kit
for Internet
publishing of
Government
datasets using
the Open Data
http://ogdisdk.cloudapp.ne
t
Open Spec
protocols, file formats,
standards,
technical
specifications
http://www.microsoft.com
/openspecification
s
BizSpark
Program for Start-Up
companies from
both
commercial and
open source
backgrounds
http://www.microsoft.com
/bizspark
Openness and Interoperability @Microsoft
How can I receive up-to-date Openness announcements from Microsoft?
In addition to the websites above, you can receive regular updates to
Microsoft’s openness, interoperability and standards efforts via the following
channels:
• http://blogs.technet.com/b/openness/
• http://blogs.msdn.com/b/interoperability/
• http://twitter.com/OpenAtMicrosoft
• http://port25.technet.com
• http://channel9.msdn.com/Blogs/Interoperability

More Related Content

What's hot

Implement Web API with Swagger
Implement Web API with SwaggerImplement Web API with Swagger
Implement Web API with SwaggerJiang Wu
 
Everybody loves Swagger (Massimo Crippa @ Integration Monday)
Everybody loves Swagger (Massimo Crippa @ Integration Monday)Everybody loves Swagger (Massimo Crippa @ Integration Monday)
Everybody loves Swagger (Massimo Crippa @ Integration Monday)Codit
 
Isomorphic javascript - Uppsala.js #8
Isomorphic javascript - Uppsala.js #8Isomorphic javascript - Uppsala.js #8
Isomorphic javascript - Uppsala.js #8Alexander Aivars
 
Swagger - make your API accessible
Swagger - make your API accessibleSwagger - make your API accessible
Swagger - make your API accessibleVictor Trakhtenberg
 
Swagger in the API Lifecycle
Swagger in the API LifecycleSwagger in the API Lifecycle
Swagger in the API LifecycleOle Lensmar
 
Sistema de Notificações com SignalR TDC 2014
Sistema de Notificações com SignalR TDC 2014Sistema de Notificações com SignalR TDC 2014
Sistema de Notificações com SignalR TDC 2014Waldyr Felix
 
Building APIs with Node.js and Swagger
Building APIs with Node.js and SwaggerBuilding APIs with Node.js and Swagger
Building APIs with Node.js and SwaggerJeremy Whitlock
 
Microsoft Azure Cloud Services
Microsoft Azure Cloud ServicesMicrosoft Azure Cloud Services
Microsoft Azure Cloud ServicesRodrigo Kono
 
Consuming Restful APIs using Swagger v2.0
Consuming Restful APIs using Swagger v2.0Consuming Restful APIs using Swagger v2.0
Consuming Restful APIs using Swagger v2.0Pece Nikolovski
 
Rest API with Swagger and NodeJS
Rest API with Swagger and NodeJSRest API with Swagger and NodeJS
Rest API with Swagger and NodeJSLuigi Saetta
 
Frappé Framework - A Full Stack Web Framework
Frappé Framework - A Full Stack Web FrameworkFrappé Framework - A Full Stack Web Framework
Frappé Framework - A Full Stack Web Frameworkrushabh_mehta
 
Documenting your REST API with Swagger - JOIN 2014
Documenting your REST API with Swagger - JOIN 2014Documenting your REST API with Swagger - JOIN 2014
Documenting your REST API with Swagger - JOIN 2014JWORKS powered by Ordina
 
Building ext js apps with ES2015 using sencha visual studio code plugin
Building ext js apps with ES2015 using sencha visual studio code pluginBuilding ext js apps with ES2015 using sencha visual studio code plugin
Building ext js apps with ES2015 using sencha visual studio code pluginSandeep Adwankar
 
ASP.NET Identity - O Novo componente de Membership do ASP.NET
ASP.NET Identity - O Novo componente de Membership do ASP.NETASP.NET Identity - O Novo componente de Membership do ASP.NET
ASP.NET Identity - O Novo componente de Membership do ASP.NETEduardo Pires
 
Customizing workflows in WSO2 API Manager
Customizing workflows in WSO2 API ManagerCustomizing workflows in WSO2 API Manager
Customizing workflows in WSO2 API ManagerWSO2
 
O futuro do desenvolvimento .NET
O futuro do desenvolvimento .NETO futuro do desenvolvimento .NET
O futuro do desenvolvimento .NETRodrigo Kono
 
Visual Studio: The best tool for web developers.
Visual Studio: The best tool for web developers.Visual Studio: The best tool for web developers.
Visual Studio: The best tool for web developers.Robert MacLean
 
Build your own dev tools with salesforce cli plugin generator
Build your own dev tools with salesforce cli plugin generatorBuild your own dev tools with salesforce cli plugin generator
Build your own dev tools with salesforce cli plugin generatorMohith Shrivastava
 
What’s new in LightSwitch 2013?
What’s new in LightSwitch 2013?What’s new in LightSwitch 2013?
What’s new in LightSwitch 2013?Robert MacLean
 

What's hot (20)

Implement Web API with Swagger
Implement Web API with SwaggerImplement Web API with Swagger
Implement Web API with Swagger
 
Everybody loves Swagger (Massimo Crippa @ Integration Monday)
Everybody loves Swagger (Massimo Crippa @ Integration Monday)Everybody loves Swagger (Massimo Crippa @ Integration Monday)
Everybody loves Swagger (Massimo Crippa @ Integration Monday)
 
Isomorphic javascript - Uppsala.js #8
Isomorphic javascript - Uppsala.js #8Isomorphic javascript - Uppsala.js #8
Isomorphic javascript - Uppsala.js #8
 
Swagger - make your API accessible
Swagger - make your API accessibleSwagger - make your API accessible
Swagger - make your API accessible
 
Swagger in the API Lifecycle
Swagger in the API LifecycleSwagger in the API Lifecycle
Swagger in the API Lifecycle
 
Sistema de Notificações com SignalR TDC 2014
Sistema de Notificações com SignalR TDC 2014Sistema de Notificações com SignalR TDC 2014
Sistema de Notificações com SignalR TDC 2014
 
Building APIs with Node.js and Swagger
Building APIs with Node.js and SwaggerBuilding APIs with Node.js and Swagger
Building APIs with Node.js and Swagger
 
Build HTML5 Sites/Apps with Kendo UI Core
Build HTML5 Sites/Apps with Kendo UI CoreBuild HTML5 Sites/Apps with Kendo UI Core
Build HTML5 Sites/Apps with Kendo UI Core
 
Microsoft Azure Cloud Services
Microsoft Azure Cloud ServicesMicrosoft Azure Cloud Services
Microsoft Azure Cloud Services
 
Consuming Restful APIs using Swagger v2.0
Consuming Restful APIs using Swagger v2.0Consuming Restful APIs using Swagger v2.0
Consuming Restful APIs using Swagger v2.0
 
Rest API with Swagger and NodeJS
Rest API with Swagger and NodeJSRest API with Swagger and NodeJS
Rest API with Swagger and NodeJS
 
Frappé Framework - A Full Stack Web Framework
Frappé Framework - A Full Stack Web FrameworkFrappé Framework - A Full Stack Web Framework
Frappé Framework - A Full Stack Web Framework
 
Documenting your REST API with Swagger - JOIN 2014
Documenting your REST API with Swagger - JOIN 2014Documenting your REST API with Swagger - JOIN 2014
Documenting your REST API with Swagger - JOIN 2014
 
Building ext js apps with ES2015 using sencha visual studio code plugin
Building ext js apps with ES2015 using sencha visual studio code pluginBuilding ext js apps with ES2015 using sencha visual studio code plugin
Building ext js apps with ES2015 using sencha visual studio code plugin
 
ASP.NET Identity - O Novo componente de Membership do ASP.NET
ASP.NET Identity - O Novo componente de Membership do ASP.NETASP.NET Identity - O Novo componente de Membership do ASP.NET
ASP.NET Identity - O Novo componente de Membership do ASP.NET
 
Customizing workflows in WSO2 API Manager
Customizing workflows in WSO2 API ManagerCustomizing workflows in WSO2 API Manager
Customizing workflows in WSO2 API Manager
 
O futuro do desenvolvimento .NET
O futuro do desenvolvimento .NETO futuro do desenvolvimento .NET
O futuro do desenvolvimento .NET
 
Visual Studio: The best tool for web developers.
Visual Studio: The best tool for web developers.Visual Studio: The best tool for web developers.
Visual Studio: The best tool for web developers.
 
Build your own dev tools with salesforce cli plugin generator
Build your own dev tools with salesforce cli plugin generatorBuild your own dev tools with salesforce cli plugin generator
Build your own dev tools with salesforce cli plugin generator
 
What’s new in LightSwitch 2013?
What’s new in LightSwitch 2013?What’s new in LightSwitch 2013?
What’s new in LightSwitch 2013?
 

Similar to Sinergija2012 - Developing REST API for Windows Azure with ASP.NET Web API

ASP.NET Mvc 4 web api
ASP.NET Mvc 4 web apiASP.NET Mvc 4 web api
ASP.NET Mvc 4 web apiTiago Knoch
 
Vijay Oscon
Vijay OsconVijay Oscon
Vijay Osconvijayrvr
 
Developing Apps with Azure AD
Developing Apps with Azure ADDeveloping Apps with Azure AD
Developing Apps with Azure ADSharePointRadi
 
Vijay Mix Presentation
Vijay Mix PresentationVijay Mix Presentation
Vijay Mix Presentationvijayrvr
 
RESTful API-centric Universe
RESTful API-centric UniverseRESTful API-centric Universe
RESTful API-centric UniverseTihomir Opačić
 
Teched India Vijay Interop Track
Teched India Vijay Interop TrackTeched India Vijay Interop Track
Teched India Vijay Interop Trackvijayrvr
 
Best of Microsoft Dev Camp 2015
Best of Microsoft Dev Camp 2015Best of Microsoft Dev Camp 2015
Best of Microsoft Dev Camp 2015Bluegrass Digital
 
Serverless in Azure with Functions
Serverless in Azure with FunctionsServerless in Azure with Functions
Serverless in Azure with FunctionsChristos Matskas
 
apidays LIVE Paris 2021 - Lessons from the API Stewardship Journey in Azure b...
apidays LIVE Paris 2021 - Lessons from the API Stewardship Journey in Azure b...apidays LIVE Paris 2021 - Lessons from the API Stewardship Journey in Azure b...
apidays LIVE Paris 2021 - Lessons from the API Stewardship Journey in Azure b...apidays
 
Developer’s Independence Day: Introducing the SharePoint App Model
Developer’s Independence Day:Introducing the SharePoint App ModelDeveloper’s Independence Day:Introducing the SharePoint App Model
Developer’s Independence Day: Introducing the SharePoint App Modelbgerman
 
Connector API Apps
Connector API AppsConnector API Apps
Connector API AppsBizTalk360
 
Web API or WCF - An Architectural Comparison
Web API or WCF - An Architectural ComparisonWeb API or WCF - An Architectural Comparison
Web API or WCF - An Architectural ComparisonAdnan Masood
 
ASP.NET AJAX with Visual Studio 2008
ASP.NET AJAX with Visual Studio 2008ASP.NET AJAX with Visual Studio 2008
ASP.NET AJAX with Visual Studio 2008Caleb Jenkins
 
Azure serverless architectures
Azure serverless architecturesAzure serverless architectures
Azure serverless architecturesBenoit Le Pichon
 

Similar to Sinergija2012 - Developing REST API for Windows Azure with ASP.NET Web API (20)

M meijer api management - tech-days 2015
M meijer   api management - tech-days 2015M meijer   api management - tech-days 2015
M meijer api management - tech-days 2015
 
Running PHP In The Cloud
Running PHP In The CloudRunning PHP In The Cloud
Running PHP In The Cloud
 
ASP.NET Mvc 4 web api
ASP.NET Mvc 4 web apiASP.NET Mvc 4 web api
ASP.NET Mvc 4 web api
 
Vijay Oscon
Vijay OsconVijay Oscon
Vijay Oscon
 
Gab2015 samir arezki_api management
Gab2015 samir arezki_api managementGab2015 samir arezki_api management
Gab2015 samir arezki_api management
 
Azure API Management
Azure API ManagementAzure API Management
Azure API Management
 
Developing Apps with Azure AD
Developing Apps with Azure ADDeveloping Apps with Azure AD
Developing Apps with Azure AD
 
Vijay Mix Presentation
Vijay Mix PresentationVijay Mix Presentation
Vijay Mix Presentation
 
RESTful API-centric Universe
RESTful API-centric UniverseRESTful API-centric Universe
RESTful API-centric Universe
 
Teched India Vijay Interop Track
Teched India Vijay Interop TrackTeched India Vijay Interop Track
Teched India Vijay Interop Track
 
Best of Microsoft Dev Camp 2015
Best of Microsoft Dev Camp 2015Best of Microsoft Dev Camp 2015
Best of Microsoft Dev Camp 2015
 
Serverless in Azure with Functions
Serverless in Azure with FunctionsServerless in Azure with Functions
Serverless in Azure with Functions
 
apidays LIVE Paris 2021 - Lessons from the API Stewardship Journey in Azure b...
apidays LIVE Paris 2021 - Lessons from the API Stewardship Journey in Azure b...apidays LIVE Paris 2021 - Lessons from the API Stewardship Journey in Azure b...
apidays LIVE Paris 2021 - Lessons from the API Stewardship Journey in Azure b...
 
Developer’s Independence Day: Introducing the SharePoint App Model
Developer’s Independence Day:Introducing the SharePoint App ModelDeveloper’s Independence Day:Introducing the SharePoint App Model
Developer’s Independence Day: Introducing the SharePoint App Model
 
Real-Time Web Applications with ASP.NET WebAPI and SignalR
Real-Time Web Applications with ASP.NET WebAPI and SignalRReal-Time Web Applications with ASP.NET WebAPI and SignalR
Real-Time Web Applications with ASP.NET WebAPI and SignalR
 
Getting Started with API Management
Getting Started with API ManagementGetting Started with API Management
Getting Started with API Management
 
Connector API Apps
Connector API AppsConnector API Apps
Connector API Apps
 
Web API or WCF - An Architectural Comparison
Web API or WCF - An Architectural ComparisonWeb API or WCF - An Architectural Comparison
Web API or WCF - An Architectural Comparison
 
ASP.NET AJAX with Visual Studio 2008
ASP.NET AJAX with Visual Studio 2008ASP.NET AJAX with Visual Studio 2008
ASP.NET AJAX with Visual Studio 2008
 
Azure serverless architectures
Azure serverless architecturesAzure serverless architectures
Azure serverless architectures
 

More from Radenko Zec

Introduction to Azure DocumentDB
Introduction to Azure DocumentDBIntroduction to Azure DocumentDB
Introduction to Azure DocumentDBRadenko Zec
 
Developing advanced windows phone apps
Developing advanced windows phone appsDeveloping advanced windows phone apps
Developing advanced windows phone appsRadenko Zec
 
Windays12 ASP.NET Web API
Windays12 ASP.NET Web APIWindays12 ASP.NET Web API
Windays12 ASP.NET Web APIRadenko Zec
 
Sinergija2013 ASP.NET Web API to the max
Sinergija2013 ASP.NET Web API to the maxSinergija2013 ASP.NET Web API to the max
Sinergija2013 ASP.NET Web API to the maxRadenko Zec
 
MsNetwork2011 -How to build extensible silverlight application using MEF
MsNetwork2011 -How to build extensible silverlight application using MEFMsNetwork2011 -How to build extensible silverlight application using MEF
MsNetwork2011 -How to build extensible silverlight application using MEFRadenko Zec
 
MsCommunity2013- Single page application case study - Silverreader
MsCommunity2013-  Single page application case study - SilverreaderMsCommunity2013-  Single page application case study - Silverreader
MsCommunity2013- Single page application case study - SilverreaderRadenko Zec
 
MsCommunity2012 - Developing REST API using ASP.NET Web API
MsCommunity2012 - Developing REST API using ASP.NET Web APIMsCommunity2012 - Developing REST API using ASP.NET Web API
MsCommunity2012 - Developing REST API using ASP.NET Web APIRadenko Zec
 
MsNetwork2013 Easy transition to HTML 5 using MVVM
MsNetwork2013 Easy transition to HTML 5 using MVVMMsNetwork2013 Easy transition to HTML 5 using MVVM
MsNetwork2013 Easy transition to HTML 5 using MVVMRadenko Zec
 

More from Radenko Zec (8)

Introduction to Azure DocumentDB
Introduction to Azure DocumentDBIntroduction to Azure DocumentDB
Introduction to Azure DocumentDB
 
Developing advanced windows phone apps
Developing advanced windows phone appsDeveloping advanced windows phone apps
Developing advanced windows phone apps
 
Windays12 ASP.NET Web API
Windays12 ASP.NET Web APIWindays12 ASP.NET Web API
Windays12 ASP.NET Web API
 
Sinergija2013 ASP.NET Web API to the max
Sinergija2013 ASP.NET Web API to the maxSinergija2013 ASP.NET Web API to the max
Sinergija2013 ASP.NET Web API to the max
 
MsNetwork2011 -How to build extensible silverlight application using MEF
MsNetwork2011 -How to build extensible silverlight application using MEFMsNetwork2011 -How to build extensible silverlight application using MEF
MsNetwork2011 -How to build extensible silverlight application using MEF
 
MsCommunity2013- Single page application case study - Silverreader
MsCommunity2013-  Single page application case study - SilverreaderMsCommunity2013-  Single page application case study - Silverreader
MsCommunity2013- Single page application case study - Silverreader
 
MsCommunity2012 - Developing REST API using ASP.NET Web API
MsCommunity2012 - Developing REST API using ASP.NET Web APIMsCommunity2012 - Developing REST API using ASP.NET Web API
MsCommunity2012 - Developing REST API using ASP.NET Web API
 
MsNetwork2013 Easy transition to HTML 5 using MVVM
MsNetwork2013 Easy transition to HTML 5 using MVVMMsNetwork2013 Easy transition to HTML 5 using MVVM
MsNetwork2013 Easy transition to HTML 5 using MVVM
 

Recently uploaded

Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Scott Keck-Warren
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksSoftradix Technologies
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticscarlostorres15106
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptxLBM Solutions
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsMemoori
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?XfilesPro
 
Azure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAzure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAndikSusilo4
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 3652toLead Limited
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...HostedbyConfluent
 
Artificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraArtificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraDeakin University
 

Recently uploaded (20)

Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other Frameworks
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptxE-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping Elbows
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptx
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
 
The transition to renewables in India.pdf
The transition to renewables in India.pdfThe transition to renewables in India.pdf
The transition to renewables in India.pdf
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?
 
Azure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAzure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & Application
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
 
Artificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraArtificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning era
 

Sinergija2012 - Developing REST API for Windows Azure with ASP.NET Web API

  • 1. Razvoj REST API-ja za Windows Azure koristeći ASP.NET Web API Radenko Zec, Lanaco d.o.o October 24rd, 2012
  • 2. Cilj prezentacije • napraviti “Real World” Web API koristeći ASP.NET Web API
  • 3. Šta je REST ? • to je stil softverske arhitekture, za distribuirane hypermedia sisteme kao što je „World Wide Web“ • nije protokol ni standard
  • 4. Šta je ASP.NET Web API ? • Frejmvork koji omogućava lak razvoj HTTP servisa kojima se može pristupati sa velikog broja različitih klijenata uključujući browsere i mobilne uređaje
  • 5. Da li je ASP.NET Web API = RESTful service? • ASP.NET Web API ne diktira stil arhitekture • ali vi možete da razvijete RESTful service pomoću ASP.NET Web API- ja
  • 9. Koje metode ASP.NET Web API podržava Metod Akcija HTTPMetod Relativni URI Get Vraća listu svih kontakata GET /api/contacts Get Vraća kontakt na osnovu id-a GET /api/contacts/id Add Dodaje novi kontakt POST /api/contacts Update Mijenja selektovani kontakt PUT /api/contacts Delete Briše kontakt DELETE /api/contacts/id
  • 11. Kako implementirati Web API • Nasljediti klasu ApiController • Implementirati akcije – akcije se mapiraju na HTTP metode – stavite prefix ispred metoda za željeni HTTP method (PostCustomer)
  • 12. DEMO
  • 13. Action parameters • prosti tipovi se dobijaju iz URI-ja – route data, query parameters http://api.mssinergija.net/kontakt?kod=nesto • kompleksni tipovi – request body – MediaTypeFormatters koriste se za deserijalizaciju Request Body-ja zavisno od content type-a – JSON i XML su podržani pod default-u
  • 14. Validacija • Validacija se vrši na podacima prilikom svakog request-a • greške prilikom validacije se snimaju u ModelState • provjerite ModelState.IsValid
  • 15. Filteri • Tipovi filtera : – Action filters (pokreću se prije i nakon poziva akcije) – Authorization filters (pokreću se prije model binding-a i služe za autorizaciju korisnika) – Exception filters (generišu odgovor u slučaju greške na centralizovan način) • Oni mogu biti konfigurisani globalno, po kontroleru i po akciji
  • 16. HTTP Dispatcher Invoke Action Action filters Model Bind Select action Exception filters Route to controller Formatting Request Response Authorization filters
  • 17. Opis Web API-ja • koristi se IApiExplorer servis da bi se dobio runtime opis Web API-ja • korisno prilikom izrade help stranica, test klijenata, alata i sl. • http://nuget.org/packages/Microsoft.AspNet.Web Api.HelpPage
  • 18. IApiExplorer public ActionResult Index() { var apiExplorer = GlobalConfiguration.Configuration.Services. GetApiExplorer(); return View(apiExplorer); }
  • 19. Hosting • dva načina hostovanja – ASP.NET Web Application (IIS) – Self-host (npr. console application, Windows service, Azure Worker Role, itd.) • hostovanje u memoriji je korisno za integration testiranje servisa
  • 20. DEMO
  • 23. Help us choose the best Sinergija lecturer! HTC and Microsoft will award you – at the conference end, we’ll give one HTC Windows Phone 8X to someone from the audience – randomly. Go to www.mssinergija.net, log in and cast your votes! You can rate only lectures that you were present at, just once. More lectures you rate, more chances you have. Please use computers at the front of this room, or rate lecture from your phone or home computer, at Sinergija portal. This prize contest will end at Thursday, October 24th at 21:00. Winner will be announced at the official Sinergija web portal, www.mssinergija.net Please rate this lecture and WIN Windows Phone 8X by HTC! Powered by:
  • 24. Microsoft and Open Source gateway for deeper exploration of open source engagements http://www.microsoft.com /openness Port25 blogs from the platform community and the OSS Lab teams http://Port25.technet.com Codeplex resources for developers and consumers of open source projects http://www.codeplex.com Interoperability Bridges technical collaborative works http://www.interoperabilit ybridges.com Open Up cross-Industry Interoperability and Standards activities http://www.microsoft.com /interop/openup Shared Source portal for programmaticall y sharing code http://www.microsoft.com /sharedsource OData open source starter kit for Internet publishing of Government datasets using the Open Data http://ogdisdk.cloudapp.ne t Open Spec protocols, file formats, standards, technical specifications http://www.microsoft.com /openspecification s BizSpark Program for Start-Up companies from both commercial and open source backgrounds http://www.microsoft.com /bizspark Openness and Interoperability @Microsoft How can I receive up-to-date Openness announcements from Microsoft? In addition to the websites above, you can receive regular updates to Microsoft’s openness, interoperability and standards efforts via the following channels: • http://blogs.technet.com/b/openness/ • http://blogs.msdn.com/b/interoperability/ • http://twitter.com/OpenAtMicrosoft • http://port25.technet.com • http://channel9.msdn.com/Blogs/Interoperability