WHO AM I REST Dissertation by Roy Fielding
WHO AM I?
REST? • Dissertation by Roy Fielding 2000 • “Architectural Styles and the Design of Network-based Software Architectures” • Re. ST = Representational State Transfer
Architectural constraints • • • Client–server Stateless Cacheable Layered system Uniform Interface
Scalability GET http: //fabrikam. com/API/User/42
Guiding principles of REST-interfaces • Identification of resources • Manipulation of resources through representations of these resources • Self-descriptive messages • Hypermedia as the engine of application state
HATEOAS Hypermedia as the engine of application state
Example of hypermedia representation (Netflix)
Richardsons maturity model Glory of REST Level 3: Hypermedia Controls Level 2: HTPP Verbs Level 1: Resources Level 0: The swamp of POX
REST on Microsoft – some history • WCF pre-3. 5: painful… • WCF 3. 5: Web. Http. Binding. • WCF REST Starter Kit (no longer supported) • WCF Data Services (OData) • WCF Web API - Preview 1 - 6
WCF ASP. NET Web API
http: //www. asp. net/web-api • Goal: One HTTP/ REST / Hypermedia API Fx • Integrated in ASP. NET: Best of both world
WCF to ASP. NET Web API WCF Web API Service Operation Service contract Endpoint URI templates Message handlers Formatters Operation handlers ASP. NET Web API => => Web API controller Action n/a ASP. NET Routing Same Filters, model binders
DEMO – FILE NEW
Media types & Media Formatters
Media types & Media Formatters • Built in support for: – XML – JSON – form-urlencoded data • Can be extended with custom Media Formatters
DEMO – MEDIA TYPE FORMATTER
Web API on Nu. Get • Web API hosted in ASP. NET: – Asp. Net. Web. Api • Self-hosted Web API: – Asp. Net. Web. Api. Selfhost • Http. Client including XML and JSON formatters: – System. Net. Http. Formatting • Json. Value for navigating and manipulating JSON: – System. Json Newtonsoft. Json
Node-style Web API? http: //blogs. msdn. com/b/youssefm/archive/2012/02/24/ writing-a-lightweight-web-service-using-webapi-building-blocks. aspx
DEMO – SELF HOSTING
Web API can be used for all levels ASP. NET Web API Glory of REST Level 3: Hypermedia Controls Level 2: HTPP Verbs Level 1: Resources Level 0: The swamp of POX
OAuth/Claims based security http: //zamd. net/
Open Source: http: //aspnetwebapi. codeplex. com
Some good reading
Thank you! Robert Folkesson | Active Solution robert. folkesson@activesolution. se | @rfolkes www. robertfolkesson. se
- Slides: 26