Big, public REST application: Seniors Canada Online

[Update: partial contact information at bottom.] Yesterday I found out about a major government XML+HTTP (i.e. REST) web application that has been open to the general public since October 2004 but was never formally announced — I’m posting about it here with permission from the federal department that’s hosting it.

The Seniors Canada Online web site is designed to provide amalgamated information for senior citizens from all levels of government — currently it contains seniors’ information from the Canadian federal government, the provincial and territorial governments, and the city of Brockville, but more municipalities and NGOs will likely be joining in the future. Instead of simply providing an HTML interface for human readers, however, the site’s maintainers decided to make information available via XML as well so that other jurisdictions (such as provinces and cities) could include the same seniors’ information in their web sites. In fact, since it’s wide open, anyone can experiment with using the XML data.

According to the developer, the implementation was trivial — the REST application shares its database and application logic with the HTML web site, so the XML part is just a thin view written on top of all that, running in parallel with the HTML view.

Simple Example

Currently, the REST interface is read-only, and all requests are HTTP GETs, so they are bookmarkable, cacheable, linkable, and all the other good stuff that comes with REST. Here’s a simple example that searches for the word “sport”:

The result is an XML-encoded list of URLs and Dublin-Core-style metadata; here’s an example of one item in the result list:

<dcdescription>ACTIVE2010 is a comprehensive strategy to increase participation in sport and physical activity throughout Ontario.</dcdescription>

Canada is a bilingual country, however, so you will reasonably expect that you could make the same query for French-language resources. Give it a try:

Nuts and Bolts

I’m not going to describe the XML format here, since anyone who knows XML and Dublin Core will be able to puzzle it out in a few seconds.

Here are some request parameters that work with many of the REST URLs:

“en” (the default) to request English-language results, or “fr” to request French-language results.
An identifier from the coverage metadata table (see below) to restrict results to a specific area.
An identifier from the category metadata table (see below) to restrict results to a specific hierarchical category.

Here are the GET URLs with any local request parameters:
Get a listing of three-level coverage metadata (i.e. geographical locations). Use the request parameter dccoverageid instead of geo to restrict the results to a specific subset.
Get the a listing of three-level categorization metadata.
Get an alphabetical listing of search keywords available. Use the request parameter letter to restrict the results to keywords beginning with a specific letter.
Get XML-encoded search results. Use the request parameter search to specify the search string, searchop to specify the search type (“all”, “or” or “exact”), and recfrom to specify the starting position in the results (defaults to 1).

For example, here is a list of French-language keywords beginning with “L”:

I’m not quite sure how the keywords relate to the search, but I’ll play around a bit and try to find out.

Update: Contact Information

After my posting, the government department that maintains this REST application has already started receiving enquiries from others considering the same thing. The site is maintained by Veterans Affairs Canada (VAC) on behalf of the Canadian Seniors Partnership (which involves multiple departments and levels of government). The technical contact for this project at VAC is Ron Broughton.

This entry was posted in Uncategorized and tagged . Bookmark the permalink.