OData is a Web API for Data Access and manipulation. It is similar to a mini-ODBC or JDBC API but specifically intended for the Web. More precisely, OData allows clients to construct URIs that name an entity set, filter among the entities it contains, and traverse relationships to related entities and collections of entities. OData provides mechanisms for resources (also known as providers) to present descriptions of the data structures they expose and for clients (also known as consumers) to access and manipulate the exposed portions of the resources via the HTTP protocol. The OData Web API describes how requests from clients and results from the providers should be formatted. The OData specification documents have been submitted to OASIS (Organization for the Advancement of Structured Information Standards) in May 2012.

Share:

Susan Malaika (malaika@us.ibm.com), Senior Technical Staff, IBM

Susan MalaikaSusan Malaika is a Senior Technical Staff Member in IBM Software Group. Her specialties include the Web and databases. She is a member of the IBM Academy of Technology. You can find out more about Susan and her publications at http://susanmalaika.blogspot.com/



24 May 2012

Also available in Russian

OData Overview

OData is a Web API for Data Access and manipulation. It is similar to a mini-ODBC or JDBC API but specifically intended for the Web. More precisely, OData allows clients to construct URIs that name an entity set, filter among the entities it contains, and traverse relationships to related entities and collections of entities. For more information please see "Introduction OData : Data Access for the Web, the cloud, mobile devices, and more".

Figure 1. Exposing database on the Web through a general purpose OData provider
Exposing database on the Web through a general purpose OData provider

Figure 1 illustrates how a resource such as a database can be exposed on the Web through a general purpose OData provider. The database data can be created, updated, deleted, and queried via the OData syntax from Web Browsers.

Figure 2. CSDL (Conceptual Schema Definition Language)
CSDL (Conceptual Schema Definition Language)

Figure 2 illustrates CSDL (Conceptual Schema Definition Language). CSDL is optional and is generated to help consumer applications understand the structure of the data being exposed. CSDL is a bit like metadata in JDBC and ODBC, helping client applications understand what they are accessing.

There are thousands of Web APIs being defined on the Internet OData is an example of such an API. You can read more about Web APIs at the Programmable Web. Standardization in this area will help advance consolidation in this important technology area and enable innovation to keep pace with market needs, in particular to support emerging data constructs and open data initiatives.

OData at OASIS

The OData proposed charter was submitted to OASIS (Organization for the Advancement of Structured Information Standards). This text is extracted from the OData proposed charter:

The work will focus on enabling:

  • The creation of REST-ful HTTP-based data services, allowing resources identified using Uniform Resource Identifiers (URIs) and defined in an abstract data model, to be published and edited by Web clients using simple HTTP messages.
  • Exposure and access of information from a variety of sources including, but not limited to, relational databases, file systems, content management systems, and traditional Web sites.

You can find the OData specification documents that were submitted to OASIS along with the proposed charter here:

In addition to the OData specification, four OData extension documents have been submitted to OASIS:

This extension documents are intended to seed work in the proposed OASIS OData Technical Committee. You can read the OData complete charter and the extension documents at OASIS.

OData and IBM Products

IBM products that support OData include:

OData Examples

This section includes some simple OData examples that access Netflix.

http://odata.netflix.com/v2/Catalog/

returns

<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<service xml:base="http://odata.netflix.com/v2/Catalog/"
         xmlns:atom="http://www.w3.org/2005/Atom"
         xmlns:app="http://www.w3.org/2007/app"
         xmlns="http://www.w3.org/2007/app">
  <workspace>
    <atom:title>Default</atom:title>
    <collection href="Genres">
      <atom:title>Genres</atom:title>
    </collection>
    <collection href="Titles">
      <atom:title>Titles</atom:title>
    </collection>
    .
    .
    .
  </workspace>
</service>

http://odata.netflix.com/v2/Catalog/$metadata

returns

<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<edmx:Edmx Version="1.0"
           xmlns:edmx="http://schemas.microsoft.com/ado/2007/06/edmx">
  <edmx:DataServices xmlns:m=
"http://schemas.microsoft.com/ado/2007/08/dataservices/metadata"
                     m:DataServiceVersion="1.0">
    <Schema Namespace="Netflix.Catalog.v2"
            xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices"
            xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata"
            xmlns="http://schemas.microsoft.com/ado/2008/09/edm">
    .
    .
    .
    </Schema>
  </edmx:DataServices>
</edmx:Edmx>

http://odata.netflix.com/v2/Catalog/Titles

returns

<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<feed xml:base="http://odata.netflix.com/v2/Catalog/"
          xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices"
xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata"
xmlns="http://www.w3.org/2005/Atom">
  <title type="text">Titles</title>
  <id>http://odata.netflix.com/v2/Catalog/Titles/</id>
  <updated>2012-05-23T21:41:18Z</updated>
  <link rel="self" title="Titles" href="Titles" />
  <entry>
    <id>http://odata.netflix.com/v2/Catalog/Titles('13aly')</id>
    <title type="text">Red Hot Chili Peppers: Funky Monks</title>
    <summary type="html">Lead singer Anthony Kiedis, bassist Flea, ... </summary>
    <updated>2012-01-31T09:45:16Z</updated>
    <author>
      <name />
    </author>
    .
    .
    .
  </entry>
</feed>

http://odata.netflix.com/v2/Catalog/Titles('13aly')

returns

<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<entry xml:base="http://odata.netflix.com/v2/Catalog/"
       xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices"
|      xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata"
       xmlns="http://www.w3.org/2005/Atom">
  <id>http://odata.netflix.com/v2/Catalog/Titles('13aly')</id>
  <title type="text">Red Hot Chili Peppers: Funky Monks</title>
  <summary type="html">Lead singer Anthony Kiedis, bassist Flea, drummer Chad Smith
... </summary>
  <updated>2012-01-31T09:45:16Z</updated>
  <author>
    <name />
  </author>
  .
  .
  .
  <category term="Netflix.Catalog.v2.Title"
scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" />

  <content type="image/jpeg"
src="http://cdn-0.nflximg.com/en_us/boxshots/large/5632678.jpg" />
  <m:properties
xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" 
xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices">
    <d:Id>13aly</d:Id>
    <d:Name>Red Hot Chili Peppers: Funky Monks</d:Name>
    <d:ShortName>Red Hot Chili Peppers: Funky Monks</d:ShortName>
    <d:Synopsis>Lead singer Anthony Kiedis, bassist Flea, 
            drummer Chad Smith ...</d:Synopsis>
    <d:ShortSynopsis>Lead singer Anthony Kiedis, bassist Flea, 
            drummer Chad Smith ... </d:ShortSynopsis>
    <d:AverageRating m:type="Edm.Double">3.4</d:AverageRating>
    <d:ReleaseYear m:type="Edm.Int32">1991</d:ReleaseYear>
    .
    .
    .
  </m:properties>
</entry>

OData and Other Web APIs

There are thousands of Web APIs in use today. Some popular Web APIs include mapping services. As of June 2012, over 6000 Web APIs were listed at the Programmable Web (see entry entitled "API Business Models Take Center Stage"). A recent Vordel survey reveals 'half of enterprises are adopting APIs to build out new business channels' with 25% of these APIs being developed specifically for mobile applications.

One area of interest is how OData relates to Linked Data API efforts. The W3C Linked Data Platform (LDP) Working Group and the OASIS OData Technical Committee both aim at defining REST APIs to access and manipulate data on the Web using different data models. LDP is based on the Resource Definition Framework (RDF) data model and OData is based on the Entity Data Model (EDM).

  • RDF was defined at W3C in 1999 and has its origins in earlier work on triples in the 1980s and 1990s, e.g. database triple stores and meta-content framework (MCF). RDF is a data model that relies on modeling information as triples, e.g., Steve's social security number is nnn-nn-nnn, Steve's gender is male, Steve purchased a table, John is friend of Steve, Joanne is friend of John etc, RDF refers to and relates resources, such as Steve, John, Joanne, table etc and their properties via universal identifiers: URIs.
  • EDM was defined by Microsoft and has its origins in Peter Chen's Entity Relationship Model defined in 1976 and still in use when creating relational database designs. EDM is a data model that relies on mapping information into entities and relationships. It relies on the use of domain specific values, e.g., social security numbers, invoice numbers, product numbers, to refer to resources and their properties, and to relate information together.

EDM presents information in a way which is familiar to many developers dealing with data today making it easy for them to understand and use. RDF enables linking up the data of the world and supports reasoning through inferencing: the ability to deduce new facts from existing information through the use of universal identifiers, associated definitions and properties.

Building adapters between heterogeneous Web APIs is possible. For example, you can find a prototype adapter linking workitems in IBM Rational Team Concert accessed via OSLC (Open Services for Life Cycle Collaboration - a Linked Data Based API), and Microsoft Sharepoint documents accessed via OData here : http://wiki.eclipse.org/Lyo/SharepointAdapter.

As the market expands, new APIs will emerge, and while they may overlap in some ways, what's clear is that developers continue to innovate in this emerging technology area as new use cases are identified.

Many Thanks

Many thanks to colleagues Elizabeth Cleary, Andrew Eisenberg, Diane Jordan, and Arnaud Le Hors for their feedback and suggestions.

Resources

Comments

developerWorks: Sign in

Required fields are indicated with an asterisk (*).


Need an IBM ID?
Forgot your IBM ID?


Forgot your password?
Change your password

By clicking Submit, you agree to the developerWorks terms of use.

 


The first time you sign into developerWorks, a profile is created for you. Information in your profile (your name, country/region, and company name) is displayed to the public and will accompany any content you post, unless you opt to hide your company name. You may update your IBM account at any time.

All information submitted is secure.

Choose your display name



The first time you sign in to developerWorks, a profile is created for you, so you need to choose a display name. Your display name accompanies the content you post on developerWorks.

Please choose a display name between 3-31 characters. Your display name must be unique in the developerWorks community and should not be your email address for privacy reasons.

Required fields are indicated with an asterisk (*).

(Must be between 3 – 31 characters.)

By clicking Submit, you agree to the developerWorks terms of use.

 


All information submitted is secure.

Dig deeper into SOA and web services on developerWorks


static.content.url=http://www.ibm.com/developerworks/js/artrating/
SITE_ID=1
Zone=SOA and web services
ArticleID=818090
ArticleTitle=OData
publish-date=05242012