Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

I am looking into writing a web service API and I am thinking of creating a REST service. What does OData means in this context? Can you please explain the difference between OData and REST?

share|improve this question
    
see: odata.org –  Emmad Kareem Oct 17 '11 at 14:14
add comment

4 Answers 4

up vote 7 down vote accepted

REST is an architecture for how to send messages back and forth from a client to server using HTTP. OData is a standard championed by Microsoft that uses a REST architecture to send particular types of messages over HTTP. OData talks about what the messages look like (the content). REST is the architecture of how those messages get sent back and forth.

share|improve this answer
add comment

I agree with both @jkohlhepp and @Tom Squires, though will add a couple of details.

OData is an open standard (championed by Microsoft, but adopted beyond Microsoft, and available for many platforms, including iOS and Android).

OData payloads are based on Atom (read) and AtomPub (update) format. (As an aside, Atom is also the basis for a popular RSS feed format.) Atom is extensible, and OData has taken advantage of this to create well-known extensions. For example, with an OData service there are URI Conventions with many capabilities, such as filtering (filter by date, or customer name) and sorting and so forth. Using these special conventions in a standard (OData-defined) way makes OData powerful since they act similar and we can build tools to work against them and such.

There are some well-known OData sources available, such as by Netflix (all their movie data is there - can be fun to play with!).

Read all about OData at odata.org.

Good luck! -Bill

share|improve this answer
add comment

OData is a standard implimented using REST.

share|improve this answer
add comment

REST is an Architectural Style of building Web Services. It's just a model that says that you could use HTTP and its verbs (POST/PUT/GET etc.) to perform CRUD on Resources exposed by your Services. But REST lacks any details on how the URLs should look like, how to request/response formats should look like, how to query information or at a basic level what operations and resources a service supports in the first place!

In the world of XML based web services, we have SOAP, WSDL, WS-* which define the standards that enable interoperability across various services and their clients.

OData is trying to do this for the REST based web services.

It defines $metadata in CSDL format to explain what (entity/complex) types your service supports and their properties, their data types, how are your types related, and if your service also support some special operations beyond the traditional CRUD.

OData standardizes the URL formats for your resources viz., /Entity, /Entity('id') or /Entity(key1=value1, key2=value2)... and so on..

OData standardizes the request/response formats in JSON and AtomXml on how the data and its metadata is structured.

OData also specifies a very rich query language to enable consumers query your services for precise information they are looking for - with the help of $filter, $orderby, $skip, $top, $expand.

OData helps you describe your entire Data Model - Entities and their Relationships and support all kinds of operations like CREATE, UPDATE, DELETE, GET, MERGE and even CUSTOM OPERATIONS on these Entities and/or Relationships.

OData v4 is now an OASIS standard which many improvements on top of its earlier versions. The ecosystem for OData is slowly growing.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.