Difference between OData and REST web services

Web ServicesRestOdata

Web Services Problem Overview


What is the difference between OData and REST-ful web services?

Web Services Solutions


Solution 1 - Web Services

UPDATE Warning, this answer is extremely out of date now that OData V4 is available.


I wrote a post on the subject a while ago here.

As Franci said, OData is based on Atom Pub. However, they have layered some functionality on top and unfortunately have ignored some of the REST constraints in the process.

The querying capability of an OData service requires you to construct URIs based on information that is not available, or linked to in the response. It is what REST people call out-of-band information and introduces hidden coupling between the client and server.

The other coupling that is introduced is through the use of EDMX metadata to define the properties contained in the entry content. This metadata can be discovered at a fixed endpoint called $metadata. Again, the client needs to know this in advance, it cannot be discovered.

Unfortunately, Microsoft did not see fit to create media types to describe these key pieces of data, so any OData client has to make a bunch of assumptions about the service that it is talking to and the data it is receiving.

Solution 2 - Web Services

The OData protocol is built on top of the AtomPub protocol. The AtomPub protocol is one of the best examples of REST API design. So, in a sense you are right - the OData is just another REST API and each OData implementation is a REST-ful web service.

The difference is that OData is a specific protocol; REST is architecture style and design pattern.

Solution 3 - Web Services

REST is a generic design technique used to describe how a web service can be accessed. Using REST you can make http requests to get data. If you try it in your browser it would be just like going to a website except instead of returning a web page you would get back XML. Some services will also return data in JSON format which is easier to use with Javascript.

OData is a specific technology that exposes data through REST.

If you want to sum it up real quick, think of it as:

  • REST - design pattern
  • OData - enabling technology

Solution 4 - Web Services

In 2012 OData underwent standardization, so I'll just add an update here..

First the definitions:

REST - is an architecture of how to send messages over HTTP.

OData V4- is a specific implementation of REST, really defines the content of the messages in different formats (currently I think is AtomPub and JSON). ODataV4 follows rest principles.

For example, asp.net people will mostly use WebApi controller to serialize/deserialize objects into JSON and have javascript do something with it. The point of Odata is being able to query directly from the URL with out-of-the-box options.

Solution 5 - Web Services

From the OData documentation:

> The OData Protocol is an application-level protocol for interacting with data via RESTful web services. > > ... > > The OData Protocol is different from other REST-based web service approaches in that it provides a uniform way to describe both the data and the data model.

Solution 6 - Web Services

> OData (Open Data Protocol) is an OASIS standard that defines the best > practice for building and consuming RESTful APIs. OData helps you > focus on your business logic while building RESTful APIs without > having to worry about the approaches to define request and response > headers, status codes, HTTP methods, URL conventions, media types, > payload formats and query options etc. OData also guides you about > tracking changes, defining functions/actions for reusable procedures > and sending asynchronous/batch requests etc. Additionally, OData > provides facility for extension to fulfil any custom needs of your > RESTful APIs. > > OData RESTful APIs are easy to consume. The OData metadata, a > machine-readable description of the data model of the APIs, enables > the creation of powerful generic client proxies and tools. Some of > them can help you interact with OData even without knowing anything > about the protocol. The following 6 steps demonstrate 6 interesting > scenarios of OData consumption across different programming platforms. > But if you are a non-developer and would like to simply play with > OData, XOData is the best start for you.

for more details at http://www.odata.org/

Solution 7 - Web Services

ODATA is a special kind of REST where we can query data uniformly from URL.

Solution 8 - Web Services

REST stands for REpresentational State Transfer which is a resource based architectural style. Resource based means that data and functionalities are considered as resources.

OData is a web based protocol that defines a set of best practices for building and consuming RESTful web services. OData is a way to create RESTful web services thus an implementation of REST.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionScottView Question on Stackoverflow
Solution 1 - Web ServicesDarrel MillerView Answer on Stackoverflow
Solution 2 - Web ServicesFranci PenovView Answer on Stackoverflow
Solution 3 - Web ServicesRush FrisbyView Answer on Stackoverflow
Solution 4 - Web ServicestatigoView Answer on Stackoverflow
Solution 5 - Web ServicesmcantiView Answer on Stackoverflow
Solution 6 - Web ServicesRajeshVermaView Answer on Stackoverflow
Solution 7 - Web ServicesMinh NguyenView Answer on Stackoverflow
Solution 8 - Web ServicesIsharaView Answer on Stackoverflow