Incomputing,Open Data Protocol (OData) is an open protocol that allows the creation and consumption of queryable and interoperableWeb service APIs in a standard way.Microsoft initiated OData in 2007.[1] Versions 1.0, 2.0, and 3.0 are released under theMicrosoft Open Specification Promise. Version 4.0 was standardized atOASIS,[2] with a release in March 2014.[3] In April 2015 OASIS submitted OData v4 and OData JSON Format v4 toISO/IEC JTC 1 for approval as aninternational standard.[4] In December 2016, ISO/IEC published OData 4.0 Core as ISO/IEC 20802-1:2016[5][6] and the OData JSON Format as ISO/IEC 20802-2:2016.[7]
The protocol enables the creation and consumption of HTTP-basedWeb APIs, which allow Web clients to publish and edit resources, identified using URLs and defined in adata model, using simple HTTP messages. OData shares some similarities withJDBC and withODBC; like ODBC, OData is not limited torelational databases.
After initial development by Microsoft, OData became a standardized protocol of the OASIS OData Technical Committee (TC).
"The OASIS OData TC works to simplify the querying and sharing of data across disparate applications and multiple stakeholders for re-use in the enterprise, Cloud, and mobile devices. A REST-based protocol, OData builds onHTTP,AtomPub, andJSON usingURIs to address and access data feed resources. It enables information to be accessed from a variety of sources including (but not limited to) relational databases, file systems, content management systems, and traditional Web sites. OData provides a way to break down data silos and increase the shared value of data by creating an ecosystem in which data consumers can interoperate with data producers in a way that is far more powerful than currently possible, enabling more applications to make sense of a broader set of data. Every producer and consumer of data that participates in this ecosystem increases its overall value."[8]
TC participants includeCA Technologies,Citrix Systems,IBM,Microsoft,Progress Software,Red Hat,SAP SE andSDL.
OData is a protocol for the creation and consumption of Web APIs. OData thus builds on HTTP, AtomPub, and JSON using URIs to address and access data feed resources.
OData uses URIs to identify resources. For every OData service whose service root is abbreviated ashttp://host/service/, the followingfixed resources can be found:
The service document lists entity sets, functions, and singletons that can be retrieved. Clients can use the service document to navigate the model in a hypermedia-driven fashion.
The service document is available athttp://host/service/
The metadata document describes the types, sets, functions and actions understood by the OData service. Clients can use the metadata document to understand how to query and interact with entities in the service.
The metadata document is available athttp://host/service/$metadata.
The URIs for the dynamic resources may be computed from thehypermedia information in the service document and metadata document
OData uses the HTTP verbs to indicate the operations on the resources.
URLs requested from an OData endpoint may include query options. The OData protocol specifies various 'system query options' endpoints should accept, these can be used to filter, order, map or paginate data.
Query options can be appended to a URL after a? character and are separated by& characters; each option consists of a$-sign prefixed name and its value, separated by a= sign, for example:OData/Products?$top=2&$orderby=Name. A number of logical operators and functions are defined for use when filtering data, for example:OData/Products?$filter=Price lt 10.00 and startswith(Name,'M') requests products with a price smaller than 10 and a name starting with the letter 'M'.
OData uses different formats for representing data and the data model. In OData protocol version 4.0, JSON format is the standard for representing data, with theAtom format still being in committee specification stage. For representing the data model, the Common Schema Definition Language (CSDL) is used, which defines an XML representation of the entity data model exposed by OData services.
A collection of products:
{"@odata.context":"http://services.odata.org/V4/OData/OData.svc/$metadata#Products","value":[{"ID":0,"Name":"Meat","Description":"Red Meat","ReleaseDate":"1992-01-01T00:00:00Z","DiscontinuedDate":null,"Rating":14,"Price":2.5},{"ID":1,"Name":"Milk","Description":"Low fat milk","ReleaseDate":"1995-10-01T00:00:00Z","DiscontinuedDate":null,"Rating":3,"Price":3.5},...]}
A collection of products:
<feedxml:base="http://services.odata.org/V4/OData/OData.svc/"m:context="http://services.odata.org/V4/OData/OData.svc/$metadata#Products"xmlns="http://www.w3.org/2005/Atom"xmlns:d="http://docs.oasis-open.org/odata/ns/data"xmlns:m="http://docs.oasis-open.org/odata/ns/metadata"xmlns:georss="http://www.georss.org/georss"xmlns:gml="http://www.opengis.net/gml"><id>http://services.odata.org/v4/odata/odata.svc/Products</id><titletype="text">Products</title><updated>2015-05-19T03:38:50Z</updated><linkrel="self"title="Products"href="Products"/><entry><id>http://services.odata.org/V4/OData/OData.svc/Products(0)</id><categoryterm="#ODataDemo.Product"scheme="http://docs.oasis-open.org/odata/ns/scheme"/><linkrel="edit"title="Product"href="Products(0)"/><linkrel="http://docs.oasis-open.org/odata/ns/relatedlinks/Categories"type="application/xml"title="Categories"href="Products(0)/Categories/$ref"/><linkrel="http://docs.oasis-open.org/odata/ns/related/Categories"type="application/atom+xml;type=feed"title="Categories"href="Products(0)/Categories"/><linkrel="http://docs.oasis-open.org/odata/ns/relatedlinks/Supplier"type="application/xml"title="Supplier"href="Products(0)/Supplier/$ref"/><linkrel="http://docs.oasis-open.org/odata/ns/related/Supplier"type="application/atom+xml;type=entry"title="Supplier"href="Products(0)/Supplier"/><linkrel="http://docs.oasis-open.org/odata/ns/relatedlinks/ProductDetail"type="application/xml"title="ProductDetail"href="Products(0)/ProductDetail/$ref"/><linkrel="http://docs.oasis-open.org/odata/ns/related/ProductDetail"type="application/atom+xml;type=entry"title="ProductDetail"href="Products(0)/ProductDetail"/><title/><updated>2015-05-19T03:38:50Z</updated><author><name/></author><contenttype="application/xml"><m:properties><d:IDm:type="Int32">0</d:ID><d:Name>Bread</d:Name><d:Description>Wholegrainbread</d:Description><d:ReleaseDatem:type="DateTimeOffset">1992-01-01T00:00:00Z</d:ReleaseDate><d:DiscontinuedDatem:null="true"/><d:Ratingm:type="Int16">4</d:Rating><d:Pricem:type="Double">2.5</d:Price></m:properties></content></entry><entry><id>http://services.odata.org/V4/OData/OData.svc/Products(1)</id><categoryterm="#ODataDemo.Product"scheme="http://docs.oasis-open.org/odata/ns/scheme"/><linkrel="edit"title="Product"href="Products(1)"/><linkrel="http://docs.oasis-open.org/odata/ns/relatedlinks/Categories"type="application/xml"title="Categories"href="Products(1)/Categories/$ref"/><linkrel="http://docs.oasis-open.org/odata/ns/related/Categories"type="application/atom+xml;type=feed"title="Categories"href="Products(1)/Categories"/><linkrel="http://docs.oasis-open.org/odata/ns/relatedlinks/Supplier"type="application/xml"title="Supplier"href="Products(1)/Supplier/$ref"/><linkrel="http://docs.oasis-open.org/odata/ns/related/Supplier"type="application/atom+xml;type=entry"title="Supplier"href="Products(1)/Supplier"/><linkrel="http://docs.oasis-open.org/odata/ns/relatedlinks/ProductDetail"type="application/xml"title="ProductDetail"href="Products(1)/ProductDetail/$ref"/><linkrel="http://docs.oasis-open.org/odata/ns/related/ProductDetail"type="application/atom+xml;type=entry"title="ProductDetail"href="Products(1)/ProductDetail"/><title/><updated>2015-05-19T03:38:50Z</updated><author><name/></author><contenttype="application/xml"><m:properties><d:IDm:type="Int32">1</d:ID><d:Name>Milk</d:Name><d:Description>Lowfatmilk</d:Description><d:ReleaseDatem:type="DateTimeOffset">1995-10-01T00:00:00Z</d:ReleaseDate><d:DiscontinuedDatem:null="true"/><d:Ratingm:type="Int16">3</d:Rating><d:Pricem:type="Double">3.5</d:Price></m:properties></content></entry>...</feed>
<edmx:EdmxVersion="4.0"xmlns:edmx="http://docs.oasis-open.org/odata/ns/edmx"><edmx:DataServices><SchemaNamespace="ODataDemo"xmlns="http://docs.oasis-open.org/odata/ns/edm"><EntityTypeName="Product"><Key><PropertyRefName="ID"/></Key><PropertyName="ID"Type="Edm.Int32"Nullable="false"/><PropertyName="Name"Type="Edm.String"/><PropertyName="Description"Type="Edm.String"/><PropertyName="ReleaseDate"Type="Edm.DateTimeOffset"Nullable="false"/><PropertyName="DiscontinuedDate"Type="Edm.DateTimeOffset"/><PropertyName="Rating"Type="Edm.Int16"Nullable="false"/><PropertyName="Price"Type="Edm.Double"Nullable="false"/></EntityType><ComplexTypeName="Address"><PropertyName="Street"Type="Edm.String"/><PropertyName="City"Type="Edm.String"/><PropertyName="State"Type="Edm.String"/><PropertyName="ZipCode"Type="Edm.String"/><PropertyName="Country"Type="Edm.String"/></ComplexType><EntityContainerName="DemoService"><EntitySetName="Products"EntityType="ODataDemo.Product"></EntitySet></EntityContainer></Schema></edmx:DataServices></edmx:Edmx>
Applications include:[9]