OData: A primer for iOS developersGlen GordonDeveloper EvangelistMicrosoft Corporationhttp://glengordon.name@glengordon
Who is this Microsoft guy?I support developer communities in GA, AL, MSI work with developers from all roles: enterprise, consultants, ISVs, students, startups, designersLots of ways to interface with something Microsoft related.NET, PHP, JavaScriptSilverlight, Windows Phone, iOSMy goal is to make members of the community successful by introducing new technology or connecting people
AgendaThe case for ODataA look at the formatProducers, services and consumersResources and tips
why data services?
break data silos
== data sharing & integration
Requirements for Web Data ServicesWeb friendly, just plain HTTPUniform patternsFocus on data, not on formatsStay high level, abstract the store
data service != gateway to databaseservice interfacebusiness logicstore
odata in 1 slide…
ODataUniform way of representing structured dataAtom, JSON formatsUniform URI conventionsNavigation, filtering, sorting, paging, etc.Uniform operationsAddressabilityGET, POST, PUT, DELETE always mean the same
REST: 3 definitionsAn architectural style for building loosely coupled systems defined by a set of very general constraints (principles) the Web (URI/HTTP/HTML/XML) is an instance of this styleThe Web used correctly (i.e., not using the Web as transport) HTTP is built according to RESTful principles services are built on top of Web standards without misusing them most importantly, HTTP is an application protocol (not a transport protocol)Anything that uses HTTP and XML (XML without SOAP) XML-RPC was the first approach for this violates REST because there is no uniform interface
The name Atom applies to a pair of related standards. The Atom Syndication Format is an XML language used for web feeds, while the Atom Publishing Protocol (AtomPub) is a simple HTTP-based protocol for creating and updating web resources.ATOMPub
http://services.odata.org/OData/OData.svc\_______________________________________/                    |                         service root URIhttp://services.odata.org/OData/OData.svc/Category(1)/Products?$top=2&$orderby=name\_______________________________________/ \__________________/  \_________________/                   |                                |                    |             service root URI                  resource path        query optionsWhat is a URI?
Full SQL like Query “Language”
Addressing entities and sets
Presentation options
Query Options
Filter Expressions
Filter Methods
Exampleshttp://services.odata.org/OData.svc/GetProductsByRating?rating=5Identifies the "GetProductsByRating" Service Operation and specifies a value of 5 for the "rating" input parameter.Service Operations(Functions)
{ "d" : {   "results": [     {       "__metadata": {           "uri": "http://services.odata.org/OData/OData.svc/Categories(0)",           "type": "DataServiceProviderDemo.Category"       },       "ID": 0,       "Name": "Food",       "Products": {          "__deferred": {            "uri": "http://services.odata.org/OData/OData.svc/Categories(0)/Products"          }       }     },      { /* another Category Entry */ },     { /* another Category Entry */ },     { /* another Category Entry */ }   ],   "__count": "3",   "__next": "http://services.odata.org/OData/OData.svc$skiptoken=12"} }JSON
Producers and Consumers
OData ProducersWindows Communication Foundation (WCF)SharePoint 2010IBM WebSphereSQL AzureWindows Azure Table StorageSQL Server Reporting ServicesMicrosoft Dynamics CRM 2011GeoRESTBuild your own
OData ServicesebayNetflixTwitpicWindows LiveNerdDinnerOpen Government Data InitiativeOpen Science Data InitiativeWindows Azure Marketplace DataMarket
OData Consumers – End UsersWeb BrowsersExcel 2010OData Explorer
OData Consumers – Client Libraries.NETJavascriptPHPJavaWindows Phone 7iOS (Objective C)RubyJoomlaDrupal
ServersWCF Data Services
SharePoint 2010
SQL Server Reporting Services 2008 R2
SQL Azure

OData for iOS developers

  • 1.
    OData: A primerfor iOS developersGlen GordonDeveloper EvangelistMicrosoft Corporationhttp://glengordon.name@glengordon
  • 2.
    Who is thisMicrosoft guy?I support developer communities in GA, AL, MSI work with developers from all roles: enterprise, consultants, ISVs, students, startups, designersLots of ways to interface with something Microsoft related.NET, PHP, JavaScriptSilverlight, Windows Phone, iOSMy goal is to make members of the community successful by introducing new technology or connecting people
  • 3.
    AgendaThe case forODataA look at the formatProducers, services and consumersResources and tips
  • 4.
  • 5.
  • 6.
    == data sharing& integration
  • 7.
    Requirements for WebData ServicesWeb friendly, just plain HTTPUniform patternsFocus on data, not on formatsStay high level, abstract the store
  • 8.
    data service !=gateway to databaseservice interfacebusiness logicstore
  • 9.
    odata in 1slide…
  • 10.
    ODataUniform way ofrepresenting structured dataAtom, JSON formatsUniform URI conventionsNavigation, filtering, sorting, paging, etc.Uniform operationsAddressabilityGET, POST, PUT, DELETE always mean the same
  • 11.
    REST: 3 definitionsAnarchitectural style for building loosely coupled systems defined by a set of very general constraints (principles) the Web (URI/HTTP/HTML/XML) is an instance of this styleThe Web used correctly (i.e., not using the Web as transport) HTTP is built according to RESTful principles services are built on top of Web standards without misusing them most importantly, HTTP is an application protocol (not a transport protocol)Anything that uses HTTP and XML (XML without SOAP) XML-RPC was the first approach for this violates REST because there is no uniform interface
  • 12.
    The name Atomapplies to a pair of related standards. The Atom Syndication Format is an XML language used for web feeds, while the Atom Publishing Protocol (AtomPub) is a simple HTTP-based protocol for creating and updating web resources.ATOMPub
  • 13.
    http://services.odata.org/OData/OData.svc\_______________________________________/ | service root URIhttp://services.odata.org/OData/OData.svc/Category(1)/Products?$top=2&$orderby=name\_______________________________________/ \__________________/ \_________________/ | | | service root URI resource path query optionsWhat is a URI?
  • 14.
    Full SQL likeQuery “Language”
  • 15.
  • 16.
  • 17.
  • 18.
  • 19.
  • 20.
    Exampleshttp://services.odata.org/OData.svc/GetProductsByRating?rating=5Identifies the "GetProductsByRating"Service Operation and specifies a value of 5 for the "rating" input parameter.Service Operations(Functions)
  • 21.
    { "d" :{ "results": [ { "__metadata": { "uri": "http://services.odata.org/OData/OData.svc/Categories(0)", "type": "DataServiceProviderDemo.Category" }, "ID": 0, "Name": "Food", "Products": { "__deferred": { "uri": "http://services.odata.org/OData/OData.svc/Categories(0)/Products" } } }, { /* another Category Entry */ }, { /* another Category Entry */ }, { /* another Category Entry */ } ], "__count": "3", "__next": "http://services.odata.org/OData/OData.svc$skiptoken=12"} }JSON
  • 22.
  • 23.
    OData ProducersWindows CommunicationFoundation (WCF)SharePoint 2010IBM WebSphereSQL AzureWindows Azure Table StorageSQL Server Reporting ServicesMicrosoft Dynamics CRM 2011GeoRESTBuild your own
  • 24.
    OData ServicesebayNetflixTwitpicWindows LiveNerdDinnerOpenGovernment Data InitiativeOpen Science Data InitiativeWindows Azure Marketplace DataMarket
  • 25.
    OData Consumers –End UsersWeb BrowsersExcel 2010OData Explorer
  • 26.
    OData Consumers –Client Libraries.NETJavascriptPHPJavaWindows Phone 7iOS (Objective C)RubyJoomlaDrupal
  • 27.
  • 28.
  • 29.
    SQL Server ReportingServices 2008 R2
  • 30.

Editor's Notes

  • #12 Representational State Transfer (REST) is defined as an architectural style, which means that it is not a concrete systems architecture, but instead a set of constraints that are applied when designing a systems architecture. We briefly discuss these constraints, but then focus on explaining how the Web is one such systems architecture that implements REST. In particular, the mechanisms of the Uniform Resource Identifiers (URIs), the Hypertext Transfer Protocol (HTTP), media types, and markup languages such as the Hypertext Markup Language (HTML) and the Extensible Markup Language (XML). We also introduce Atom and the Atom Publishing Protocol (AtomPub) as two established ways on how RESTful services are already provided and used on today's Web.
  • #22 JSON (an acronym for JavaScript Object Notation) is a lightweight text-based open standard designed for human-readable data interchange. It is derived from the JavaScript programming language for representing simple data structures and associative arrays, called objects. Despite its relationship to JavaScript, it is language-independent, with parsers available for virtually every programming language.