Just got back from the MIX10 conference. Hanging out with by buddy Clark Sell and doin podcasts, we took in and tried to absorb as much as we could. Of course the big news was around Windows Phone 7 Series and Silverlight 4 but there was also quite a buzz about OData. Personally, the moniker is a little boring but who am I to judge – the capability is the big thing. If you haven’t heard about it, it is an open protocol for working with ATOM and JSON data feeds. Just from that description, you might be thinking “so what” – well, keep reading. This protocol isn’t just so you can publish or consume feed data, you know you can do that. But, now you can output a customizable data feed without knowing the full intention of the consumer ahead of time. In other words, you can provide a data feed service that can directly respond to the consumer’s requests/queries and output the feed with only the data requested in the way best suited for them to consume and you don’t need a custom set of API endpoints to do it.
Some OData Facts:
- It is based on REST calls through HTTP so (GET, PUT, DELETE, POST, etc.) so strictly speaking, you don’t even need a client api to access OData feeds – you could do it from a browser URL/Address line.
- Feeds can be output in ATOM as well as JSON again, from the same endpoint.
- The protocol is for reading from AND writing data back to a data source
- Security around the data can be enforced
The OData site has provided access to the sample Northwind database. When you get there you will see all of the data that you can access and query against.
Notice from the result set that there is a list of all the different collections of data that you can access from this single service. You have Customers, Shippers, Products, Suppliers, Regions, Orders, etc. All you need to do to access any one of the collections is to type the collection name in the URL. This example will return a list of all products:
Note: at this point things are case-sensitive so “Products” works but “products” won’t.
If you are in Internet Explorer, and don’t see the detailed data stream, you might want to go to “Tools \ Internet Options
\ Content \ Feeds and Web Slices \ Settings”. Then, uncheck “Turn on feed reading view”. After that, you will see the actual feed data in the browser.
Cool. But, what if I only want products with a unit price over 50.00? Add a filter:
Notice that the UnitPrice is typed and is a Decimal. Others are 16bit integers, 32bit integers, booleans, etc.
Would you rather the data being sent back be in JSON format?
All of this is being done through a single endpoint. Even more important, it is being done with a standard set of query parameters which means that you will know how to publish and consume (i.e., select, extract, filter, sort and format) data coming from any feed that uses the OData Protocol. Schweeet!
Next up…Create your own publisher with WCF Data Services.
Resources and Info:
- OData.org : There’s a bunch of great information here (descriptions, samples, downloads).
- NetFlix : Try this – http://odata.netflix.com/Catalog/CatalogTitles?filter=Rating=’PG’
- SharePoint 2010 : ALL lists can be managed through the OData protocol
- Windows Azure : Easy to output data from Azure through simple configuration
- Project Codename Dallas : All data feeds are OData compliant
We’re goin to Vegas baby! Clark Sell and I will be there soaking up all the info, doin podcasts and passing out stickers. So, come see us, talk, get a sticker and smack it proudly on your laptop lid!
We’ll be at Mandalay Bay for the MIX10 conference where there will be tons of amazing info about:
Note: They will be giving out free development tools and support for all MIX10 attendees. Time to start building apps!
- Managed .NET environment
- XNA (Multi-Player/User Game and Graphic Development)
BTW, the Smackdown podcasts are hanging in the cloud and served up from Azure!
Pack your bags and get to Vegas!!!