Odata the Best Way to REST
Total Page:16
File Type:pdf, Size:1020Kb
OData The best way to REST Sam Xu Software Engineer II Microsoft About me • SDE II at Microsoft Shanghai ZiZhu • Almost 4 Years in Microsoft • 3+ years in OData Team • Focus on ODL, Web API OData • http://github.com/xuzhg Agenda • What is OData? • Where is OData? • Who provides OData? • Why choose OData? What is OData? Web Services – SOAP vs REST SOAP REST Overhead Heavyweight Lightweight Metadata Complex Simple Operations SOAP envelope HTTP VERB (Get, Post…) Resource identity SOAP envelope HTTP URI • REST: Representational State Transfer • SOAP: Simple Object Access Protocol Open Data Protocol (OData) • An open protocol of OASIS standard to allow the creation and consumption of queryable and interoperable RESTful APIs in [ a simple and standard way. ] • OASIS standard (2014/3/17) • HTTP Request/Response, Method, Status codes, etc • Entity Data Model (EDM) • JavaScript Object Notation (JSON) • Rich Query Options ($filter, $expand, etc) • …… OData Spec http://odata.org Where is OData? Microsoft “The Office 365 APIs follow REST and OData 4.0 standards for data Office 365 transport, and use the OAuth 2.0 API standard for authentications and authorization.” “Microsoft Power Query for Excel’s OData V4 support leverages the built-in functionality of the OData service to bring only the relevant Microsoft data back into Excel. ” “Azure Search service API uses Excel and Open Data Protocol (OData) Azure APIs PowerQuery for index queries. Azure Search supports OData More … version 4.” SAP SAP NetWeaver Gateway SAP OpenUI5 “It eases your development with a client-side HTML5 “SAP NetWeaver Gateway provides an API that is rendering library including a rich set of controls and designed to function in just such a manner; and it does supports data binding to different models (JSON, so using the OData protocol.” XML and OData).” Salesforce’s OData product: Lightning Connect & DataDirect Cloud “With external objects you can connect to an external data source like SAP or any other database that uses OData protocol or a simple URL.” Who provides OData? OData libraries by Microsoft Source: https://github.com/OData/ Document: http://odata.github.io/ OData libs on Nuget.org OData libraries by Apache http://olingo.apache.org/ OData libraries by JayData http://jaydata.org/ OData libraries by Breeze http://www.getbreezenow.com/documentation/odata Why choose OData? Advantages Open Standard Community Interoperability OData Industry RESTfulness practice Queryability OData is an open standard Standardization history V1.0 (2007) V4.0 (2014) V4.0 (will submit to V2.0 (2009) ISO this year) V3.0 (2012) OData OASIS TC participants OData provides interoperability Openness leads to interoperability Agreed resource identification method Agreed resource representation Agreed resource operation OData APIs are RESTful OData follows REST principles OData provides API queryability Rich system query options $filter • To narrow the result set $select • To narrow the set of properties $top and $skip • To do client side paging $orderby • To sort the result set $count, $search, • To take advanced results $value, $format… OData represents industry practices Specification covering every aspect of REST Entity Data model Model representation Context URL Batch & asynchronous URL conventions requests OData Http Verbs Version Change Data Versioning Queries Operations … requesting annotation Query Options Industry practices in different businesses Integration service Library and tooling Enterprises SaaS providers providers implementers • Microsoft • Blue garden • Jitterbit • JayData • SAP • K2 • ODataHQ • Apache • Salesforce • Creditpoint • Mulesoft • Breeze • IBM • Questionmark • Juhe Data (聚合 • Gizur • Schneider • Splunk 数据) • Pragmatiqa Electrics • Tableau • Progress software http://www.OData.org/ecosystem/ OData has a prosperous community Three personas and their needs RESTful API/client Business decision API advocates Developers makers • Tutorials • Success stories • A good protocol • Documentations • Customers to advocate and • Community • Business benefits learn from • Libraries • Everything the first two • Tooling personas need Source Codes Home of the OData community http://www.odata.org/ DEMO Basic OData URI examples http://services.odata.org/V4/TripPinService http://services.odata.org/V4/TripPinService/$metadata http://services.odata.org/V4/TripPinService/People http://services.odata.org/V4/TripPinService/People('russellwhyte') Advance Query option examples http://services.odata.org/V4/TripPinService/People?$filter=startswith(LastName,'A') http://services.odata.org/V4/TripPinService/People?$select=UserName http://services.odata.org/V4/TripPinService/People?$top=2&$skip=1 http://services.odata.org/V4/TripPinService/People?$orderby=FirstName%20desc http://services.odata.org/V4/TripPinService/People?$filter=Friends/any(e0:startswith(e0/FirstName,'W') and Friends/any(e1:(LastName eq 'Alfred')))&$select=UserName,Friends Summary OData - The best way to REST • Open protocol, open source libraries, open Open community RESTful • Protocol built on REST principles Ubiquitous • Available on any device, any platform, anywhere • Build on industry best practices, supported and Practical used by Enterprises that serves billions of users Resources • OData communityHome: • http://www.OData.org • OASIS OData TC Home: • https://www.oasis-open.org/committees/tc_home.php?wg_abbrev=OData • OData on GitHub: • https://github.com/OData/ • OData V4 sample servicesTripPin (read & write): • http://services.OData.org/V4/TripPinServiceRW • OData team of MicrosoftMail to: • [email protected] Go to: Thank You!.