OpenUpLabs APIs

What Are the OpenUpLabs APIs?

TSO's Linked Data APIs offers a way for developers to leverage their existing skills with the RDF data model. There is no need to learn the SPARQL query language. It provides a familiar RESTful interface over the data with several choices of output format.

The APIs are instances of the the 'Linked Data API' work that has been done as part of the Data.gov.uk initiative. The full specification can be found at http://code.google.com/p/linked-data-api/

TSO have created a Java version of the API specification. This is open source.

Available Implementations

Currently there are APIs for the following datasets:

If you follow the links above you will find some more information on the individual APIs.

General Information for Getting Started With An API

An item endpoint will return information about a single resource, whilst list endpoints return up to 50 results at once.

To change the number of results use the _pageSize parameter.

To go to the next page of results, use the _page parameter.

As an example:

http://gov.tso.co.uk/education/api/school/phase/primary?_page=2&_pageSize=3

Customising the Selection

If you want to return a more specific set of results than the endpoints provide, there are several options.

Viewers

Different properties of a resource can be retrieved using various viewers. A viewer is used to construct an RDF graph based on some or all of the properties of those resources selected. Based on the viewer type different properties of the resources will be retrieved.

Viewers can be invoked in the following ways:

The names of a viewer carries little meaning other than being a hint as to the level of information that the viewer returns.

As examples:

You can also add additional properties to the output with the _properties parameter:

Available Formats For Results

Besides RDF/XML (which is the default return format), turtle and JSON formats are also available by appending .ttl or .json to the URI, as in the following examples:

Alternatively the _format parameter can be used as in the following examples:

Content Negotiation

The system utilises content negotiation by default. The available formats are RDF/XML, JSON, Turtle and XML.

Required Format Accept Header MIME type
RDF/XML application/rdf+xml
JSON application/json
Turtle text/turtle
XML application/xml