REST, OData and Atom


Before I dive into other posts that explain what OData is and how to use it, I wanted to give a little background on what REST Designs are exactly as well as the Atom protocol. This protocol standard is the XML format which OData relies on to expose it’s data.

REST Designs

So many hear about it, but what does RESTFul mean and why is it getting so much attention? REST itself is a software architectural design. It is not a protocol, nor is it actually a standard (yet!). RESTFul services at their core, if done correctly, provide a way to expose data through an HTTP API (or WebAPI if you prefer) in such a way that, with little documentation, a client can use the exposed API to access data, update data and create data. This data is exposed using HTTP GET, PUT, POST and DELETE. The technique behind this design is the use of different types of XML or JSON formatted queries and responses. WebAPI ( a RESTFul design) uses JSON or straight XML, while OData (Data Services) uses a more Atom syntax. In a sense, there are similarities to SOAP in that it uses an XML type format, except SOAP has much more information required to function due to its contract nature and acts more as an envelope to serialize the data. That is about where the similarities end. SOAP is contract based and must be “consumed” in order to access its data.

OData has many conceptual similarities to the RESTFuL design pattern, but the architecture is not exactly the same. The first difference is that OData is a protocol standard and RESTFuL itself is an architectural design pattern. In saying this, OData exposes its protocol data in a REST way. The best way I can explain it is that OData sends data in a REST type implementation, but because OData itself is a protocol / standard, it only sends a specific type thus cannot be considered RESTFul. Another difference is the way in which the data is exposed via HTTP. They both expose data through the same generic method (HTTP), but the RESTFuL design pattern does things a little differently.

ATOM (Read)

Atom like all the XML formats is standard representation of data designed and approved by the W3C. If you don’t know, W3C is a committee that assists in forming the World Wide Web standards. Atom is also known as Atom Syndication Format (RFC 4287) and exposes what are known as ‘feeds’. Atom is the primary way in which standards like OData expose the data to be readable. This internet standard was originally used by bloggers to keep their subscribers up to date on their latest entries. It is this reason that an atom “feed” contains “entry” tags and is a required element within a particular Atom.

Take the following for example:

<?xml version="1.0" encoding="utf-8"?> 
<feed xmlns="">
  <title>Awesome Company</title> 
  <link href=""/>
    <name>Gregg The man</name>
    <title>What is SOAP?</title>
    <link href=""/>
    <summary>Awesome information you must know.</summary>
<content type="application/xml">
        <d:CategoryID m:type="Edm.Int32">1</d:CategoryID> 
        <d:CategoryName>C# Tips</d:CategoryName> 
        <d:Description>async is the bees neez</d:Description> 
        <d:Picture m:type="Edm.Binary">FRwvAAX#@!$fdsfswe</d:Picture> 

As you can see above, There are several fields that indicate to the subscriber (usually an Atom Feeder) when the last update was, and various information about this particular update. Usually, the updated element is checked over and over by the feeder to check for new information based on the last pull.

AtomPub (Update)

AtomPub, also known as Atom Publishing Protocol, is a set of services used to expose “collections” of elements / entities / entries as well as allow a client application the ability to create, update and delete these items. AtomPub uses Service as the first element instead of Feed and workspace instead of entry, otherwise the format is the same. When doing any CRUD type operations, HTTP GET, PUT, POST and DELETE are used to alter and get data from the exposed API.

See below for an example of an AtomPub POST (create a new category)

POST /owind.svc/Categories/ HTTP/1.1
Accept: application/atom+xml
Content-Type: application/atom+xml;type=entry
Host: localhost:8080
Content-Length: 632
Expect: 100-continue
Connection: Keep-Alive

<?xml version="1.0" encoding="utf-8"?>
<entry xmlns="">
  <title>A new Awesome category</title>
  <author><name>C# is awesome, VB stinks</name></author>
  <content type="application/xml">
        xmlns="">Everything C# there is to know</Description>

This concludes the background information. Next article, we will be diving into the C# code using OData via WCF Data Services.

Continue To Next Article…


Happy Coding!


About Gregg Coleman

I am Senior-level Software Engineer working primarily these days with .NET. I have a good working knowledge of ASP.NET MVC, Web Forms, WCF web services and Windows Services. I spend much of my time in the Web Services (SOAP and REST) world in my current job designing and implementing various SOA architectures. I have been in the software engineering industry for about 6 years now and will not now nor ever consider myself an "expert" in programming because there is always so much to learn. My favorite thing about designing software is there are always new emerging technologies and something to learn every day! My current job has me spending much of my job on the bleeding edge of technologies and changing gears all the time, so I'm never bored and always challenged. On my spare time I enjoy weight training, reading and venturing to new places near by. Of course programing and learning new technologies are another hobby of mine.
This entry was posted in ASP.NET, C#, Computer Technology, Data Services, Programming, REST, RESTFul, WCF, XML and tagged , , , , , , . Bookmark the permalink.

One Response to REST, OData and Atom

  1. Pingback: WCF Data Services OData consumption | Object Reference Hell

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s