Office of Public Sector Information

Office of Public Sector Information

Main menu and contents

Supplementary menus and contents

Developer Zone

This is the developer area of the Legislation API. It's not just for developers though! Anybody interested in getting their hands on legislation or linking to it will find useful information.

The Legislation API Developer Zone gives complete documentation for all of the available functionality.

You can follow development of this project on Twitter using #opsidev and on the PerSpectIves, the OPSI blog.

What do you want to know?

Overview

The Legislation API provides consolidated UK legislation, with a few limitations, in a variety of formats for people to reuse. There are three ways in which you might want to use the API.

Re-users

Do you want to reuse the information we are publishing? It is free for you to reuse, but you should look at the copyright and licensing information. Then dive in to the documentation about searching for items of legislation and the URI scheme we are using. You will also be interested in the formats that we provide information in.

Linkers

Do you publish information that references legislation? This service provides permanent URIs for legislation items and sections within legislation, and we would encourage you to use these URIs. However, be aware that we are not providing an HTML interface appropriate for end-users at the moment, so normal hypertext links may leave users disappointed.

If you are using RDFa within your pages, you can use the resource attribute to indicate that you are linking to a piece of legislation while including a link to the existing OPSI or SLD website. For example,

The <a rel="cite" resource="http://www.legislation.gov.uk/id/ukpga/1999/17" 
href="http://www.opsi.gov.uk/acts/acts1999/ukpga_19990017_en_1">Disability Rights Commission Act 1999</a> replaced 
the National Disability Council with the Disability Rights Commission (DRC).

will generate the triple

<> xhv:cite <http://www.legislation.gov.uk/id/ukpga/1999/17> .

If you are generating links to legislation automatically, it may be hard to construct the relevant URI because chapter numbers are often missing from citations. You can use a query to provide the correct link:

The <a rel="cite" resource="http://www.legislation.gov.uk/id?title=Disability Rights Commission Act 1999" 
href="http://www.opsi.gov.uk/acts/acts1999/ukpga_19990017_en_1">Disability Rights Commission Act 1999</a> replaced 
the National Disability Council with the Disability Rights Commission (DRC).

Browsers

Do you just want to have a look at the information we have? Because this is an API intended for re-users we are not serving any pretty HTML, but you can still search for legislation if you wish, or take a look at some sample pages.