Legislation API

The request was successful.

Dear National Archives,

Please provide copies of any developer/user documentation in relation to the legislation.gov.uk API.

Yours faithfully,

Andrew Keogh

foienquiry, National Archives

3 Attachments

Dear Mr Keogh,

Thank you for your enquiry of 16th October, in which you asked for the
following information about developer/user documentation in relation to
the legislation.gov.uk API at The National Archives.

Your request has been handled under the Freedom of Information (FOI) Act
2000. The FOI Act gives you the right to know whether we hold the
information you want and to have it communicated to you, subject to any
exemptions which may apply.

I can confirm that The National Archives holds information relevant to
your request and we are pleased to be able to provide this information to
you.

We are unable to provide you with some of the information you have
requested because it is covered by the exemption at section 40 (2) of the
FOI Act, which exempts personal information about a ‘third party’ (someone
other than the requester), if revealing it would breach the terms of Data
Protection Legislation. For further information about why this exemption
has been applied, please see the explanatory annex at the end of this
letter.

A brief introduction to the [1]www.legislation.gov.uk legislation API is
below. More detail is available in the attached guide to the API (MS Word
document). This is in the process of being updated to reflect our recent
addition of EU data to the website and to improve layout and organisation
but most information should be accurate. I'm also attaching a presentation
with accompanying notes on the URI scheme which underpins the website data
structure.

The base format for most legislation document content on the website is
XML conforming to the Crown Legislation Mark-up Language (CLML) schema.
You can access the XML data via the legislation API by adding "/data.xml"
to any legislation content page URI e.g. the XML version of the page
[2]http://www.legislation.gov.uk/ukpga/2010/1 is
[3]http://www.legislation.gov.uk/ukpga/2010... .. This data is
stored in a native XML database and transformed into several different
formats for different uses. These include the default XHTML view
(/data.htm), an Akoma Ntoso XML version (Akoma Ntoso is an international
legal XML standard - [4]http://www.akomantoso.org/ ), e.g.
[5]http://www.legislation.gov.uk/ukpga/2010... and
an HTML5 serialization of the Akoma Ntoso XML , e.g.
[6]http://www.legislation.gov.uk/ukpga/2010... (/data.html) as
well as generated PDFs, e.g.
[7]http://www.legislation.gov.uk/ukpga/2010... (/data.pdf). We
also provide a plain view of the XHTML that displays pure legislation
content without any additional functionality e.g.
[8]http://www.legislation.gov.uk/ukpga/2010... and an un-styled
version of the XHTML (/data.xht), e.g.
[9]http://www.legislation.gov.uk/ukpga/2010... .. These URI
patterns apply to all documents and sections of documents (e.g.
[10]http://www.legislation.gov.uk/uksi/2018/...>[11]http://www.legislation.gov.uk/uksi/2018/...
) except for the small number of older documents that we only have as PDF
images.

Search result pages for document searches, e.g.
[12]http://www.legislation.gov.uk/uksi or
[13]http://www.legislation.gov.uk/2016?title... , New legislation
page lists e.g. [14]http://www.legislation.gov.uk/new and Changes to
Legislation searches, as in
[15]http://www.legislation.gov.uk/changes/af... , are
available as HTML or ATOM feeds, by adding "/data.feed" to the end of the
URI e.g.  [16]http://www.legislation.gov.uk/uksi/data.... or
[17]http://www.legislation.gov.uk/2016?title... or
[18]http://www.legislation.gov.uk/new/data.f... or
[19]http://www.legislation.gov.uk/changes/af...
.. The raw XML for the feeds contains much richer metadata than that
displayed in the regular HTML pages. You may need to right-click and "view
source" when viewing a /data.feed page in your browser to see the XML.
Each feed page is limited to around 20 results but you can navigate
through paged results e.g.
[20]http://www.legislation.gov.uk/uksi/2019/... to obtain all
entries required.

In addition to the URIs above, the website supports HTTP content
negotiation. This allows users to configure browsers and/or scripts to
specify a certain format to be returned from the default URI rather than
using the "/data.xxx" extension.

The CLML schema itself is available online (referenced in all CLML XML
documents) at [21]http://www.legislation.gov.uk/schema/leg... ..
Please note that the schema has a fairly complex modular structure and
each module will have a different URI. The XSLT transforms used to convert
CLML XML to the other formats and the CSS for HTML display are also
publicly available in the legislation GitHub repository
[22]https://github.com/legislation/legislati... .. All data on the
website, along with the schema and GitHub resources, can be reused under
the terms of the Open Government Licence v3.0
[23]http://www.nationalarchives.gov.uk/doc/o...
except where stated.

I hope this information is of help. If you require any further assistance
please do not hesitate to contact Legislation Services at:
[24][email address]

If you are dissatisfied with the handling of your request or the decision
which has been reached, you have the right to ask for an internal
review.  Internal review requests must be submitted within two months of
the date of this response and should be addressed to:

Quality Manager
The National Archives
Kew
Richmond
Surrey
TW9 4DU
[25][email address]

Please mark your complaint clearly. You have the right to ask the
Information Commissioner (ICO) to investigate any aspect of your
complaint. However, please note that the ICO is likely to expect internal
complaints procedures to have been exhausted before beginning her
investigation.

We were due to respond to your request on the 13th November 2019. Due to
an administrative error the response was not issued until today. Please
accept our apologies for this delay.

Yours sincerely,

FOI Assessor
Freedom of Information Centre
The National Archives

EXPLANATORY ANNEX

Your request in full

Dear National Archives,

Please provide copies of any developer/user documentation in relation to
the legislation.gov.uk API.

Yours faithfully,

Andrew Keogh

Exemptions applied

Section 40(2): Personal Information where the applicant is not the data
subject

The Data Protection Legislation prevents personal information from release
if it would be unfair or at odds with the reason why it was collected, or
where the subject had officially served notice that releasing it would
cause them damage or distress.

In this case the exemption applies because the information contains names
of junior members of staff.

Further guidance can be found at:
[26]http://ico.org.uk/for_organisations/guid...

If you would like to contact us again regarding this request, please
contact us by replying to this e-mail.

Remember to quote your call reference number: F0059623 in any
correspondence, as this will assist us in providing you with a quick
response.
[27]www.nationalarchives.gov.uk

Please don't print this e-mail unless you really need to.

show quoted sections

References

Visible links
1. http://www.legislation.gov.uk/
2. http://www.legislation.gov.uk/ukpga/2010/1
3. http://www.legislation.gov.uk/ukpga/2010/1
4. http://www.akomantoso.org/
5. http://www.legislation.gov.uk/ukpga/2010/1
6. http://www.legislation.gov.uk/ukpga/2010/1
7. http://www.legislation.gov.uk/ukpga/2010/1
8. http://www.legislation.gov.uk/ukpga/2010/1
9. http://www.legislation.gov.uk/ukpga/2010/1
10. file:///tmp/<A HREF=
11. http://www.legislation.gov.uk/uksi
12. http://www.legislation.gov.uk/uksi
13. http://www.legislation.gov.uk/2016?title...
14. http://www.legislation.gov.uk/new
15. http://www.legislation.gov.uk/changes/af...
16. http://www.legislation.gov.uk/uksi
17. http://www.legislation.gov.uk/2016?title...
18. http://www.legislation.gov.uk/new
19. http://www.legislation.gov.uk/changes/af...
20. http://www.legislation.gov.uk/uksi
21. http://www.legislation.gov.uk/schema/leg...
22. https://github.com/legislation/legislati...
23. http://www.nationalarchives.gov.uk/doc/o...
24. mailto:[email address]
25. mailto:[email address]
26. http://ico.org.uk/for_organisations/guid...
27. http://www.nationalarchives.gov.uk/