Share via


Exercise 1: Introduction to Open Data Protocol

In this exercise, you will learn the advantages provided by Open Data Protocol, the ecosystem; where it works, and why developers should write applications and services using the Open Data Protocol as their Data Access protocol.

Today, one important value in a connected world is the ability to reuse and share data, by creating a system that can support multiples data sources.

The Open Data Protocol, referred to as OData, is a web protocol for querying and updating data and it was born of the need to break down data silos and increase their shared value. This allows data silos to interoperate between producers such as SQL Server, SharePoint servers, Cloud Storage Services, and consumers, for example Java, PHP, Silverlight, IIS, ASP.NET, AJAX.

OData uses web technologies, such as HTTP, Atom Publishing (AtomPub), and JSON to provide access to information from a range of applications, services, and stores like relational databases, file systems, content management systems, and traditional web sites.

OData is also defined as a set of open extensions / conventions to AtomPub that are documented and released under the principle of OSP (Open Specification Promise) to allow everyone to freely interoperate with OData implementations. 

Currently, the following Microsoft products support OData:

  • Microsoft Visual Studio 2008 SP1
  • Microsoft Visual Studio 2010
  • Microsoft Office Excel 2010 (Through PowerPivot)
  • SharePoint 2010
  • SQL Server 2008 R2
  • Windows Azure Table Storage

Using OData as the default data access protocol, allows your application to work and interact with other systems; without any implementation restriction because it supports HTTP, XML and JSON.

Note:
The data in OData is represented as rows using Atom feeds, where each entry has the usual metadata and is structured as name/value pairs inside content.

Task 1 – Exploring an OData Feed

In this task, you will browse an OData feed and perform a simple query to filter out the data.

  1. Open an Internet Explorer windows and browse to the following URL.

    The data shown contains general locations and amenity information about recreation parks of the Department of Columbia and it is formatted as an OData feed.

  2. Add a filter to return only the data about MEDIAN parks. To do this, add the following query string to the URL and press the ENTER key to see the filtered results.

    • ?$filter=use_type eq 'MEDIAN'

    The resulting URL is the following.

    URL

    https://ogdi.cloudapp.net/v1/dc/RecreationParks/?$filter=use_type eq 'MEDIAN'

  3. You can perform a more complex query on the data, for example adding an additional filter.

    Replace, the previous query string with the following one, which shows MEDIAN parks that have seven or more wardens. The following is the resulting URL.

    URL

    https://ogdi.cloudapp.net/v1/dc/RecreationParks/?$filter=(use_type eq 'MEDIAN') and (ward ge '7')

    Figure 3

    Results feed of the OData query

Note:
This data used in this exercise, is real data taken from the Open Government Data Initiative (OGDI). The OGDI project contains data gathered from government agencies. For more information about OData, see www.odata.org.