In this article, we will learn
- What is Open Data Protocol (OData)?
- Why we need OData?
- How OData works?
The Problem: Accessing Diverse Data in a Common Way
Our world is awash in data. Vast amounts exist today, and more is created every year.
There are many possible sources of data. The data may come from cloud or some database or from some other source. As there are many data sources, there are many possible clients: Web browsers, apps on mobile devices, business intelligence (BI) tools, and more.
The one of main problem here is - How these different clients access these diverse data sources.
Solution without OData:
One solution is that - Every data source defines its own approach to exposing data.
While this would work, it leads to some ugly problems like:
- It requires every client to contain unique code for each data source it will access, a burden for the people who write those clients.
- It requires the creators of each data source to specify and implement their own approach to getting at their data, making each one reinvent this wheel.
- With custom solutions on both sides, there's no way to create an effective set of tools to make life easier for the people who build clients and data sources.
Let us see an example here.
Suppose a Web application wishes to expose its data to apps on mobile phones, for instance. Without some common way to do this, the Web application must implement its own approach, forcing every client app developer that needs its data to support this.
Take other example where we need to connect various BI tools with different data sources to answer business questions. If every data source exposes data in a different way, analyzing that data with various tools is hard.
The conclusion is – We need a common approach to expose data in a simple and standard way.
That's exactly why OData was created.
What is OData (Open Data Protocol)?
OData (Open Data Protocol) is an open protocol for sharing data. In other words - OData defines an abstract data model and a protocol that let any client access information exposed by any data source.
OData is a REST (Representational State Transfer) protocol; therefore even a simple web browser can view the data exposed through an OData service.
It uses well known web technologies like HTTP, AtomPub and JSON.
The fundamental idea is that any OData client can access any OData data source
. Rather than creating unique ways to expose and access data, data sources and their clients can instead rely on the single solution that OData provides.
History of OData:
OData was originally created by Microsoft. Yet OData isn't a Microsoft-only technology.
Microsoft has included OData under its Open Specification Promise, guaranteeing the protocol's long-term availability for others. Open Specification Promise allow anyone to freely interoperate with OData implementations".
Why use the OData?
Currently a lot of common ways of designing web API's have emerged on the web. Many of them already apply REST and use JSON or XML to expose data.
However these APIs are not uniform.
OData solves this problem by providing a uniform way to expose, structure, query and manipulate data using REST practices
and JSON or ATOM syntax to describe the payload.
OData also provides a uniform way to represent metadata
about the data, allowing computers to know more about the type system, relationships and structure of the data.
OData can be used freely without the need for a license or contract.
OData is also extensible
. This allows SAP to supplement the data types used by OData with extra information from ABAP Data Dictionary
Example of OData Service:
This is an example of OData service taken from odata.org.