What is the difference between OData and REST-ful web services?
-
2One is producer, the other is enabler for the consumers. – Kangkan Jan 24 '14 at 11:06
8 Answers
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.

- 139,164
- 32
- 194
- 243
-
-
1@felickz Sorry about that. I was having DNS issues. It should be working now. Or will be when your dns cache expires. – Darrel Miller Oct 18 '11 at 22:09
-
this answer might be outdated now.. as the client is not only microsoft and mentions edmx only if you use a .net environment – sksallaj Jan 14 '13 at 15:11
-
1@sksallaj From what I read here in the V3 OData spec http://www.odata.org/media/30002/OData.html#metadatadocumentrequest CSDL is still the spec that defines the OData data model. Nothing has changed there. It has never been the case that OData clients were limited to MS tech. – Darrel Miller Jan 14 '13 at 16:05
-
6Actually this *is* out of date. V3 of OData has added 'JSON Light' which addresses both of these concerns (which are really just one), i.e. $metadata is how you know to build queries, so all that was missing is a link to $metadata in resource representations. That has been added, so both problems disappear in one go. – Alex James Mar 15 '13 at 16:34
-
1@AlexJames Which is good, because it means you fixed stuff. :-) I suppose I could update my answer to be more relevant today. I'll add it to my to-do list. – Darrel Miller Mar 15 '13 at 17:48
-
1
-
@jeroenk Oops, moved to a new,more reliable host, and forgot to setup the permalink configuration. Thanks. – Darrel Miller Apr 15 '13 at 14:25
-
"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" this is not true, this information can be obtained by asking for the metadata, and you are free to link to this if you wish. – beyond-code Mar 07 '14 at 16:22
-
@Roysvork Earlier versions of OData had no link to the metadata. – Darrel Miller Mar 07 '14 at 16:59
-
$metadata has always been part of the spec... we shouldn't confuse the failings of a particular implementation with the protocol itself. – beyond-code Mar 10 '14 at 10:35
-
@Roysvork By metadata link, I was referring to a hyperlink to the metadata in the OData response. – Darrel Miller Mar 10 '14 at 11:22
-
I know... but that was a failing of Microsoft's implementation, not the protocol itself. – beyond-code Mar 11 '14 at 09:35
-
11@DarrelMiller You mentioned that your answer is now out of date. Care to add an update with your opinion on the topic? I would still be interested in knowing the difference between OData 4 and REST. Many thanks – Kurren Jul 27 '15 at 16:10
-
2@Kurren It's on my to-do list, but unfortunately it is a long list. – Darrel Miller Jul 27 '15 at 18:39
-
2@DarrelMiller Hope you will find some time to update the post sometime soon to make it upto date with OData V4. – LCJ Jul 08 '16 at 17:38
-
-
Hi @DarrelMiller, I guess your ToDo-list must be of epic length ;-) Any chance updating this answer might make it to the top of the list? Would be great to have an updated version here. – Kaadzia Jun 15 '22 at 06:22
-
The irony is that now I work with OData every single day. I have just fixed my blog that has been broken for years. Maybe I will be inspired to write something. – Darrel Miller Jul 09 '22 at 16:06
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.

- 74,861
- 18
- 132
- 169
-
I might be wrong on this (just started learning about odata), but as of version 3 of the [protocol][http://www.odata.org/documentation] it appears theres also a JSON format specified, which you can use alternatively. Can you shed some light on this? – Johannes Rudolph Aug 28 '12 at 06:07
-
1@JohannesRudolph, honestly I have no idea. I haven't looked at OData in the last two years. But it is quite likely that Microsoft would've added JSON support. Note though, that this does not in any way change any of the responses here. JSON vs XML is just a matter of presentation of the REST resources. – Franci Penov Aug 28 '12 at 20:08
-
1You can specify in the request what format you would like to have. XML and JSON should be both supported by most implementations by e.g. setting the Accept header to application/json (starting from OData version 2) – i000174 Jul 06 '16 at 07:45
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

- 13,943
- 11
- 55
- 103

- 11,388
- 19
- 63
- 83
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.

- 2,174
- 1
- 26
- 32
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.

- 101,809
- 122
- 424
- 632

- 1,964
- 2
- 17
- 14
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/

- 2,145
- 2
- 24
- 37

- 1,087
- 9
- 13
ODATA is a special kind of REST where we can query data uniformly from URL.

- 2,106
- 1
- 28
- 34
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.

- 71
- 4