The legislation API provides a simple means by which developers can query the legislation data to retrieve results in a format of their choice, without the need to formulate a SPARQL query. The API provides single item endpoints and list endpoints, for retrieving multiple items.
To retrieve details of a single item of legislation, use the pattern:
List endpoints provide a means to retreive multiple items. The items are divided into pages with a fixed number of items on each page.
To get a list of all legislation:
To get a specific page w.r.t. a specific number of items per page:
To retrieve a list of legislation by created within a range of dates, use the pattern:
The level of detail in the retrieved results depends on a pre-configured default viewer. To control the level of detail which is reported, an alternative viewer can be selected by appending an _view parameter, e.g.:
There are currently three viewers:
The default view is medium.
Results can be obtained in a variety of formats: XML, RDF+XML, Turtle and JSON. The format of the returned results can be selected by adding a path extension to any API request, e.g.:
To retrieve results in XML:
To retrieve results in XML+RDF:
To retrieve results in Turtle:
To retrieve results in JSON:
For a complete list of the available endpoints, properties and viewers, please see the Legislation API reference.