IndyNDA Wrap-up for August 2010 – OData
This month at IndyNDA we heard from Dan Rigsby (@DanRigsby) regarding OData. OData is a web protocol that allows for the querying of data as a service.
OData is built upon REST principle of web services. REST is a move away from the complicated SOAP protocols that were popular in the 1990’s. Unfortunately SOAP is a standard that became too complicated and was modified by too many organizations to be considered an open specification. A computer scientist, Roy Fielding, developed the idea that web services and querying data could use the HTTP protocol.
Dan explained that REST is more of a style, not a specification. REST uses existing web communications (HTTP) and focuses on resources not operations.
4 Tenets of REST:
- Embrace the URI – parts of the URI map to domain
- HTTP Verbs = Methods – GET, PUT, POST, and DELETE – GET is special since it represents 99% of calls
- Content-type = Object model – submit/return types of calls – for example XML and JSON
- Status code = Result – for example 200 Ok, 201 Created, 404 Not Found
Advantages of REST:
- Web = Reach (interoperability)
- Very light weight
- Apps become as scalable as the web (cache)
- less work on client-side
- everything accessible by URI
OData is also build using the Atom/Pub XML specification. Atom is an XML standard for publishing and editing web resources. You might be familiar with its use for publishing blogs and news on the web.
Advantages of Atom:
- Atom preserves Metadata – link, updated date, author, etc…
- Constructs – complex object such as author could contain name, url, contact…
- Atom has a very RESTful structure
Dan then linked these pieces back to OData. OData was meant to expose a data source to the world. Because it needs to become a standard it was build upon REST and Atom. Also, data access is standardized (structure, URL, operations) so that any OData client can connect to and query data from any OData resource.
The OData website has lists of both producers and consumers of OData feeds. In respect to consumers, there is a standalone application, OData Explorer, that will allow you to navigate an OData feed. For Visual Studio developers, Microsoft has built the WCF Data Services library into the .Net Framework to work with OData feeds. There are also many other developer tools to connect to OData using PHP, Javascript, ruby, and Objective-C.
An example organization that gives OData access to its resources is Netflix (http://odata.netflix.com/Catalog) To get the metadata of the resource structure, you go to http://odata.netflix.com/Catalog/$metadata . An example of a query that would grab movie titles of rated G movies is http://odata.netflix.com/Catalog/Titles?$filter=Rating eq ‘G’
You can find Dan Rigsby at http://www.danrigsby.com/blog/ and on Twitter at http://www.twitter.com/danrigsby.
Comments
Matt Mahan
AuthorThis is good stuff to recap! Thank you Trey!