Build a RESTful service with OData Congyong Su
Build a RESTful service with OData Congyong Su Senior Software Engineering Manager Microsoft
Why RESTful service? API leverages the semantics of HTTP Verbs: Post, Get, Put/Patch, Delete Methods: Create, Read, Update, Delete Uri: Resource hierarchy Status: 200 OK, 404 Not Found Content: application/json API integration to web Foundation piece for dynamic web – for example, the MVVM pattern Reach Desktop, phone, device, etc.
Why OData service? Consistency REST is an architectural style Conventions API path inferred POST ~/Customers GET ~/Customers/{id} PATCH ~/Customers/{id} DELETE ~/Customers/{id} Rich query filter, select, expand, orderby, top, skip, count
How to build an OData service OData Web API If you are familiar to Model-View-Controller: MVC Start from small Low-level control RESTier If you used and miss WCF Data Services Focus on business logic
Standard Solution: OData v 4 Web API Model builder OData. Convention. Model. Builder Routing Map. OData. Service. Route Controller OData. Controller Query Enable. Query. Attribute
Demo: OData v 4 Web API
Why RESTier? Web API is easy, but require a controller per entity set OData. Lib is powerful, but with low-level APIs Zero controller is possible Focus on business logic
What is RESTier? A turnkey solution to build RESTful API services Builds upon OData v 4 Web API and OData. Lib
Demo: RESTier
Summary OData v 4 Web API is easy to start with RESTier is another layer of abstraction on top of OData Web API
Questions?
- Slides: 11