SlideShare a Scribd company logo
1 of 16
Download to read offline
Radenko Zec
Lanaco d.o.o
ASP.NET Web API do
maksimuma
October 23rd 2013
O čemu pričamo i ne pričamo danas
• ASP.NET Web API v1
• ASP.NET Web API v2
• Attribute routing
• Owin self host (Katana)
• IHttpActionResult
• OData improvements...
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
ASP.NET Web API Web sajtovi
Mobilni i tablet
uređaji
Web API
Baza
Drugi tipovi
aplikacija
Richardson-ov model zrelosti REST-a
Rast Web API-ja
Koje metode podržava Web API ?
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
Kako napraviti Web API?
public class PersonController : ApiController
{
List<Person> _people;
public PersonController()
{
_people = new List<Person>();
_people.AddRange(new Person[]
{
new Person { Id = 1, Name = "Chuck Norris" },
new Person { Id = 2, Name = "David Carradine" },
new Person { Id = 3, Name = "Bruce Lee" }
});
Kako napraviti Web API?
// GET /api/person
public IEnumerable<Person> Get()
{
return _people;
}
// GET /api/person/5
public Person Get(int id)
{
return _people.First(x => x.Id == id);
}
Rutiranje Web API-ja
public static void RegisterRoutes(RouteCollection routes)
{
routes.MapHttpRoute(
name: "DefaultApi",
routeTemplate: "api/{controller}/{id}",
defaults: new { id = RouteParameter.Optional }
);
}
Hosting i arhitektura
SilverReader
• Ultra brz Web API
• Korišten ASP.NET Web API v1
DEMO
Optimizacije
• Westwind serijalizer
• GZIP kompresija
Hvala na pažnji

More Related Content

Viewers also liked

Viewers also liked (12)

Estrategia de inversión semanal 23 01 2012
Estrategia de inversión semanal 23 01 2012Estrategia de inversión semanal 23 01 2012
Estrategia de inversión semanal 23 01 2012
 
Emociones y sentimientos
Emociones y sentimientosEmociones y sentimientos
Emociones y sentimientos
 
Redisenandome dossier
Redisenandome dossierRedisenandome dossier
Redisenandome dossier
 
Bases babolat cup 2013 c.t. utebo
Bases babolat cup 2013 c.t. uteboBases babolat cup 2013 c.t. utebo
Bases babolat cup 2013 c.t. utebo
 
Presentación sobre el Megabus
Presentación sobre el MegabusPresentación sobre el Megabus
Presentación sobre el Megabus
 
Thu de nghi ghe van chuyen
Thu de nghi ghe van chuyenThu de nghi ghe van chuyen
Thu de nghi ghe van chuyen
 
E/M-Banking in India: State of the Agent Network
E/M-Banking in India: State of the Agent NetworkE/M-Banking in India: State of the Agent Network
E/M-Banking in India: State of the Agent Network
 
200611252114240.perico trepa por chile resumen
200611252114240.perico trepa por chile resumen200611252114240.perico trepa por chile resumen
200611252114240.perico trepa por chile resumen
 
2014-CWP-Sustainability-Report
2014-CWP-Sustainability-Report2014-CWP-Sustainability-Report
2014-CWP-Sustainability-Report
 
Cortés macías lizette zareh
Cortés macías lizette zarehCortés macías lizette zareh
Cortés macías lizette zareh
 
Letra da música do Boss ac
Letra da música do Boss acLetra da música do Boss ac
Letra da música do Boss ac
 
Los protegidos 3º temporada
Los protegidos 3º temporadaLos protegidos 3º temporada
Los protegidos 3º temporada
 

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
 
Sinergija2012 - Developing REST API for Windows Azure with ASP.NET Web API
Sinergija2012 - Developing REST API for Windows Azure with ASP.NET Web APISinergija2012 - Developing REST API for Windows Azure with ASP.NET Web API
Sinergija2012 - Developing REST API for Windows Azure with ASP.NET Web APIRadenko 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
 
Sinergija2012 - Developing REST API for Windows Azure with ASP.NET Web API
Sinergija2012 - Developing REST API for Windows Azure with ASP.NET Web APISinergija2012 - Developing REST API for Windows Azure with ASP.NET Web API
Sinergija2012 - Developing REST API for Windows Azure with ASP.NET Web API
 
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
 

Sinergija2013 ASP.NET Web API to the max

  • 1. Radenko Zec Lanaco d.o.o ASP.NET Web API do maksimuma October 23rd 2013
  • 2. O čemu pričamo i ne pričamo danas • ASP.NET Web API v1 • ASP.NET Web API v2 • Attribute routing • Owin self host (Katana) • IHttpActionResult • OData improvements...
  • 3. 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
  • 4.
  • 5. ASP.NET Web API Web sajtovi Mobilni i tablet uređaji Web API Baza Drugi tipovi aplikacija
  • 8. Koje metode podržava Web API ? 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
  • 9. Kako napraviti Web API? public class PersonController : ApiController { List<Person> _people; public PersonController() { _people = new List<Person>(); _people.AddRange(new Person[] { new Person { Id = 1, Name = "Chuck Norris" }, new Person { Id = 2, Name = "David Carradine" }, new Person { Id = 3, Name = "Bruce Lee" } });
  • 10. Kako napraviti Web API? // GET /api/person public IEnumerable<Person> Get() { return _people; } // GET /api/person/5 public Person Get(int id) { return _people.First(x => x.Id == id); }
  • 11. Rutiranje Web API-ja public static void RegisterRoutes(RouteCollection routes) { routes.MapHttpRoute( name: "DefaultApi", routeTemplate: "api/{controller}/{id}", defaults: new { id = RouteParameter.Optional } ); }
  • 13. SilverReader • Ultra brz Web API • Korišten ASP.NET Web API v1
  • 14. DEMO