UK MSDN Flash Newsletter

MSDN Flash Feature Article 28th July 2010

The Open Data Protocol (OData).

It’s hard to write an article to teach you anything about OData in 500 words. Why set out on that journey when we can do something “less boring instead”;

  1. Run up your browser. I recommend IE8 as it seems to have most control around viewing raw XML but you can use “View Source” in FireFox or Chrome. Remember in IE8 to switch off the lipstick that it applies to ATOM/RSS data by using the following menu options; Tools|Internet Options|Content|Feeds/Web Slices|Settings|Feed Reading View OFF
  2. Point it at (the Netflix movie catalog in OData format)
  3. Notice that the default XML namespace is the open standard ATOM Publishing Protocol
  4. Query for Movie People:
  5. Notice that the default XML namespace is the open standard ATOM XML format
  6. Double extra bonus points for spotting that it is supplemented with elements from the Open Data Protocol published under Microsoft’s Open Specification Promise
  7. Scroll down to the bottom and notice that the data is being paged by the server – if you’re feeling adventurous, follow the hyperlink to the next page of data (the one with $skiptoken). If you’re got some time to kill, keep following those “next” links for a few hours J
  8. Try to locate Nicole Kidman:$filter=endswith(Name,'Kidman')
  9. Too many Kidmans? Choose the top record:$filter=endswith(Name,'Kidman')&$top=1
  10. Not perhaps the best way of finding Nicole (‘Papa?’), use the primary key instead:
  11. Which films has Nicole been in? Who could forget the classic “Days of Thunder” with Tom Cruise as “Cole Trickle”:
  12. What if I wanted Nicole’s info as well as the titles she’s acted in?:$expand=TitlesActedIn
  13. Too much data? Sort these titles alphabetically and return the first page of data for a page size of 3:$orderby=ShortName&$top=3
  14. But to do paging I’ll be needing the total record count (notice m:count element with value 47):$orderby=ShortName&$top=3&$inlinecount=allpages
  15. Next page:$orderby=ShortName&$top=3&$inlinecount=allpages&$skip=3
  16. Prefer JSON? Well, there’s no accounting for taste but I know “Cole Trickle” preferred it too:$orderby=ShortName&$top=3&$inlinecount=allpages&$skip=3&$format=json

Getting a feel for it? It’s not just about querying though…

OData is a web protocol based on open standards for RESTful querying and modification of exposed collections of data. It takes the basics of REST and adds mechanisms for addressing, metadata, batching, and data representation using HTTP, AtomPub, Atom and JSON.

Want to expose OData endpoints? See here. There is support in a number of products and also in .NET Framework (V3.5 Sp1 onwards) for easily exposing OData endpoints from standard data models such as those provided by Entity Framework and also from custom data models provided by your own code.

Want to consume OData endpoints? See here. There are client libraries for all kinds of clients including AJAX, full .NET, Silverlight and Windows Phone 7.

Either way, go here and watch Pablo explain it more fully (double-click the video once you’ve started it playing as no-one can be expected to watch a video playing in a 1.5inch square J)



If you have any questions, suggestions or comments for the UK MSDN Team in regard to the UK MSDN Flash, don’t hesitate to email us on

Windows Live™ ID: Sign up requires a Windows Live ID. This is required to help secure your information and protect your privacy. Find out more here.

UK Flash Resources

Sign-up for UK MSDN flash newsletter Sign up now
Sign-up for the free UK Flash newsletter

Read the current issue of the UK MSDN Flash Newsletter Read the current issue
Interested? Check out the latest issue of the UK MSDN Flash.

Read past issues - UK MSDN Flash Newsletter Read past issues
Browse past issues in the UK MSDN Flash archive

View poll results - UK MSDN Flash Newsltter View Poll Results
View feedback on issues relevant to developing in the UK

UK MSDN Flash ebooks UK MSDN Flash eBooks
MSDN eBook "The Best Technical Articles of 2009" (pdf or online)
MSDN eBook "The Best Technical Articles of 2008" (pdf or online)

UK MSDN Flash ebooks UK MSDN Flash Podcast
Download or subscribe to the companion podcast.

Other resources - Hot Topics

Windows Azure Windows Azure

Windows Azure resources handpicked by our technology experts


Discover New Features of .NET Framework 3.5 SP1 with Free Training

Visual Studio Visual Studio

Review these top Visual Studio resources chosen by our technology experts

Skills Skills

Learn New Skills - Free Visual Studio 2008 Training Programmes

Windows Client Windows Client

Everything you need to start coding Windows Client, Windows Presentation Framework & Silverlight applications

Office 2010 Office 2010

Introduction to Microsoft Office 2010 including Office Web Apps Beta