0
The Open Data Protocol
(OData)


Mike Taulty
Microsoft UK
mtaulty@microsoft.com
mtaulty.com
@mtaulty
RESTful services
client WLTM service for RESTful interactions




          client                  service
                               ...
client WLTM service for RESTful interactions
        Application Code            Application Code          2
         Cust...
key points involved here?

 1. HTTP       as the transport
               What’s so great about
 2. URI        that?indica...
ready to build?
       before you get to technologies

        1) URI scheme for addressing
           resources?
        ...
OData is a specification
OData


  builds on the RESTful fundamentals
          HTTP         XML         JSON


  to provide an open specification ...
it’s the usual “build or buy” trade-off


                                           standard
 •   productivity
 •   exist...
OData Basics
                            typed Entry
                                   property
     service             ...
demo
quick exploration of an OData service
OData URIs and Querying

         http://odata.netflix.com/Catalog/ Genres(‘Action Classics’)/Titles ? $orderby=R

       ...
filters

        Logic       Arithmetic        String          Date/Time
 eq             add              contains      se...
demo
querying OData services
service metadata

   an odata service can offer metadata
   describing the service
     greatly facilitates building clien...
demo
accessing service metadata
( including http://bit.ly/odataVisualizer )
operations

             specification also deals with



                   INVOKE
                   GET
               ...
batching

      optimise round trips to the server
           be more “transactional”
            GET /Titles

           ...
specification ->
 implementation
OData on the server
Custom via WCF Data Services
SharePoint 2010
SQL Azure
Azure Table Storage
SQL Reporting Services
IBM ...
WCF Data Services                                                                                           IDataServiceMe...
demo
building an OData service
OData on the client
.NET – desktop, server, Silverlight, Windows Phone 7
Javascript
iPhone (Objective C)
Java
PHP
Ruby
demo
building an OData client
more?




         www.odata.org
     or to see the website in odata
    services.odata.org/website/odata.svc
© 2010 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be...
Upcoming SlideShare
Loading in...5
×

Mike Taulty OData (NxtGen User Group UK)

2,354

Published on

Slides from a talk I did on OData at the NxtGen User Group in the UK.

Published in: Technology
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
2,354
On Slideshare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
67
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

Transcript of "Mike Taulty OData (NxtGen User Group UK)"

  1. 1. The Open Data Protocol (OData) Mike Taulty Microsoft UK mtaulty@microsoft.com mtaulty.com @mtaulty
  2. 2. RESTful services
  3. 3. client WLTM service for RESTful interactions client service 3 2 1 resources
  4. 4. client WLTM service for RESTful interactions Application Code Application Code 2 Customer { ID = 2 } Customer { ID = 2 } XML Client Stack XML Server Stack BODY = <customer/> BODY = <customer/> URI = http://service?id=2 URI = http://service?id=2 VERB = POST STATUS = OK VERB = POST STATUS = OK HTTP Client Stack HTTP Server Stack client service
  5. 5. key points involved here? 1. HTTP as the transport What’s so great about 2. URI that?indicates resource 1) Simplicity 3. VERB indicates action 2) Low barrier to entry 4. STATUS CODE3) Standardised indicates outcome technologies already proven on the internet 5. XML as the payload(s)
  6. 6. ready to build? before you get to technologies 1) URI scheme for addressing resources? 2)someone must have (MVC) this WCF Can client compose done (REST) (REST) LINQ to XML additional ASP.NET WCF queries? already? 3) XML payload format? JSON WebClient IIS as well? 4) client payload format with Sharing service clients? 5) Including/linking to related data?
  7. 7. OData is a specification
  8. 8. OData builds on the RESTful fundamentals HTTP XML JSON to provide an open specification for exposing an abstract data model by adding URI addressing scheme payload using AtomPub, Atom and JSON metadata using the Entity Data Model batching mechanism for requests
  9. 9. it’s the usual “build or buy” trade-off standard • productivity • existing frameworks/libraries • tooling support • existing skillsets custom • full control • does what you want and no more
  10. 10. OData Basics typed Entry property service property entries need to have a ... feed primary key property link feed ... link all links are URI’s ... media link BLOB feed service must publish a service document typed Entry operation JSON listing top level feeds in AtomPub or ... ... operation typed Entry
  11. 11. demo quick exploration of an OData service
  12. 12. OData URIs and Querying http://odata.netflix.com/Catalog/ Genres(‘Action Classics’)/Titles ? $orderby=R resource path query options $orderby (asc, desc ) Collection /Genres $top Entry /Genres(‘Action Classics’) $skip Entry Property /Genres(‘Action Classics’)/Name $filter Entry Property (text) /Genres(‘Action Classics’)/Name/$value $expand Cardinality /Genres/$count $format (*) Navigation /Genres(‘Action Classics’)/Titles $select Navigation Links /Genres(‘Action Classics’)/$links/Titles $inlinecount Service Operation /ServiceOp?param1=‘val1’ $ - some custom option
  13. 13. filters Logic Arithmetic String Date/Time eq add contains second ne sub endswith hour gt mul startswith minute gteq div length day lt mod indexof month lteq round insert year and floor or ceiling remove x 2 Type not replace isof substring cast tolower toupper trim concat
  14. 14. demo querying OData services
  15. 15. service metadata an odata service can offer metadata describing the service greatly facilitates building clients service description is represented using the Entity Data Model (EDM) fully docmented in the specification Visual Studio (e.g.) supports this metadata format via “Add Service Reference”
  16. 16. demo accessing service metadata ( including http://bit.ly/odataVisualizer )
  17. 17. operations specification also deals with INVOKE GET DELETE POST PUT client service client service maintaining links including MIME types for ATOM/JSON maintaining linkshere including creating links MERGE also applicable concurrency checking lists including partial via ETags concurrency checkingvia ETags including protocol versioning tunnelling over POST tunnelling over POST
  18. 18. batching optimise round trips to the server be more “transactional” GET /Titles GET /People RESPONSE POST /People(‘Tom Cruise’) (multipart MIME) client service POST (multipart MIME) $Batch
  19. 19. specification -> implementation
  20. 20. OData on the server Custom via WCF Data Services SharePoint 2010 SQL Azure Azure Table Storage SQL Reporting Services IBM WebSphere
  21. 21. WCF Data Services IDataServiceMetadataProvider ( ADO.NET Data Services or ‘Astoria’ ) IDataServiceQueryProvider Custom IDataServiceUpdateProvider config Provider • AcceptCountRequests Custom Data IDataServiceStreamProvider • AcceptProjectionRequests IDataServicePagingProvider defined ) ( dynamically • MaxProtocolVersion • MaxBatchCount • MaxChangesetCount • MaxExpandDepth • MaxObjectCountOnInsert • MaxResultsPerCollection • EntitySetAccessRule Host (IIS or self-hosted) • EntitySetPageSize • ServiceOperationAccessRule Custom Object WCF DataService Reflection Model Provider + IUpdatable Update Query Service Operations LINQ to SQL Model Interceptors Entity Sets Entity Framework Provider Entity Framework Model
  22. 22. demo building an OData service
  23. 23. OData on the client .NET – desktop, server, Silverlight, Windows Phone 7 Javascript iPhone (Objective C) Java PHP Ruby
  24. 24. demo building an OData client
  25. 25. more? www.odata.org or to see the website in odata services.odata.org/website/odata.svc
  26. 26. © 2010 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×