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.
Resource identification OData uses URIs to identify resources. For every OData service whose service root is abbreviated as
http://host/service/, the following
fixed resources can be found:
The service document 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 at
http://host/service/ The metadata document 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 at
http://host/service/$metadata.
Dynamic resources The URIs for the dynamic resources may be computed from the
hypermedia information in the service document and metadata document
Resource operation OData uses the HTTP verbs to indicate the operations on the resources. • GET: Get the resource (a collection of entities, a single entity, a structural property, a navigation property, a stream, etc.). • POST: Create a new resource. • PUT: Update an existing resource by replacing it with a complete instance. • PATCH: Update an existing resource by replacing part of its properties with a partial instance. • DELETE: Remove the resource.
Querying 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'.
Resource representation 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 the
Atom 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 sample OData JSON data payload 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 sample OData Atom data payload A collection of products: http://services.odata.org/v4/odata/odata.svc/Products Products 2015-05-19T03:38:50Z http://services.odata.org/V4/OData/OData.svc/Products(0) 2015-05-19T03:38:50Z 0 Bread Whole grain bread 1992-01-01T00:00:00Z 4 2.5 http://services.odata.org/V4/OData/OData.svc/Products(1) 2015-05-19T03:38:50Z 1 Milk Low fat milk 1995-10-01T00:00:00Z 3 3.5 ...
A sample OData metadata document Applications Applications include: • Progress DataDirect Hybrid Data Pipeline can expose any cloud,
big data or relational data sources as OData end points •
Socrata exposes an OData
API. •
Microsoft Azure exposes an OData
API. • Oracle Analytics Cloud can connect to an OData API •
SAP NetWeaver Gateway provides OData access to SAP Business Suite and SAP Business Warehouse. •
IBM WebSphere eXtreme Scale REST data service can be accessed by any HTTP client using OData. •
Microsoft SharePoint 2010 and up can expose its data as OData endpoint •
Office 365 exposes OData V4.0 APIs. •
Salesforce Connect consumes OData APIs. • Skyvia Connect exposes cloud and database data via OData •
Tableau can connect to OData APIs. •
TIBCO Spotfire can connect to OData APIs. • Mulesoft helps integrate with OData APIs. • SuccessFactors uses OData APIs • Ceridian HCM's Dayforce uses Odata •
Redfish uses Odata == Tools ==