Skip to content

Commit bdf0ff8

Browse files
authored
Merge pull request #179 from nationalarchives/document-atom-feed
[FCL-351] Document atom feed
2 parents 9812222 + c73ece1 commit bdf0ff8

File tree

3 files changed

+121
-9
lines changed

3 files changed

+121
-9
lines changed

doc/openapi/public_api.yml

+119-9
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
openapi: 3.1.0
22
info:
33
title: "National Archives Find Case Law: Public API"
4-
version: 0.1.3
4+
version: 0.2.0
55
description: |-
66
Our API provides access to judgments and decisions held by Find Case Law that have been converted from Microsoft Word documents into XML. These have been automatically marked up according to the [international data standard, LegalDocML](https://groups.oasis-open.org/communities/tc-community-home2?CommunityKey=3425f20f-b704-4076-9fab-018dc7d3efbe), and validated by our legal editorial team. This data includes:
77
@@ -37,8 +37,8 @@ info:
3737
url: "https://caselaw.nationalarchives.gov.uk/open-justice-licence"
3838
summary: "The Find Case Law API allows you to access court judgments and tribunal decisions held in the [Find Case Law service](https://caselaw.nationalarchives.gov.uk/), operated by the National Archives."
3939
servers:
40-
- url: "https://caselaw.nationalarchives.gov.uk"
41-
description: ""
40+
- url: "https://caselaw.nationalarchives.gov.uk/"
41+
description: "Find Case Law"
4242
components:
4343
parameters:
4444
documentUri:
@@ -50,23 +50,127 @@ components:
5050
example: ewhc/tcc/2022/42
5151
description: The unique identifier for this document within Find Case Law.
5252
responses:
53-
judgmentFeed:
54-
description: An Atom feed of recently published judgments
53+
documentFeed:
54+
description: |
55+
An Atom feed of documents, sorted by one of the dates within those documents.
5556
content:
5657
application/atom+xml:
5758
schema:
5859
description: List in Atom
59-
judgment:
60+
document:
6061
description: "The contents of a single document, as [Akoma Ntoso XML](https://www.oasis-open.org/standard/akn-v1-0/)."
6162
content:
6263
application/akn+xml:
6364
schema:
6465
description: Akoma Ntoso
6566
paths:
67+
"/atom.xml":
68+
get:
69+
summary: Get a Atom feed of documents
70+
description: |
71+
Without any parameters, this will give the most recently handed down judgments and decisions. The parameters used are identical to
72+
those used for the advanced search at https://caselaw.nationalarchives.gov.uk/judgments/search: a link to the feed mirroring those
73+
search results is available on each search result.
74+
75+
Each differently named parameter filters out documents that do not match it.
76+
77+
The feed has multiple pages (see the `link` tag with a `rel` attribute of `next` for the next page).
78+
79+
Each `entry` tag contains a different document's metadata. Notable tags include:
80+
* `<tna:contenthash>`: A hash of the text in the judgment, with whitespace removed. Can be used to determine if the underlying judgment text has changed.
81+
* `<link type="application/akn+xml">`: A link to the XML of the judgment
82+
* `<link type="application/pdf">`: A link to the PDF of the judgment
83+
84+
operationId: atomFeed
85+
parameters:
86+
- name: query
87+
required: false
88+
in: query
89+
schema:
90+
type: string
91+
description: |
92+
Full text search of a judgment. `"financial records"` will only find judgments with those two words in that order. Multiple
93+
space-separated words will only find judgments that have all those words.
94+
# todo: from_ and to_date_0, _1, _2, 2 is year
95+
- name: court
96+
required: false
97+
# can be multiple
98+
in: query
99+
schema:
100+
type: string
101+
description: |
102+
A court code. Currently there are two forms of court code, one used in the URL structure (`ewhc/fam`) and one used in the XML
103+
court tag `EWHC-Family`. Either can be searched for. If multiple courts or tribunals are given, results from all those courts
104+
may be returned.
105+
- name: tribunal
106+
required: false
107+
# can be multiple
108+
in: query
109+
schema:
110+
type: string
111+
description: |
112+
A tribunal. Identical to the court codes above.
113+
- name: party
114+
required: false
115+
in: query
116+
schema:
117+
type: string
118+
description: |
119+
A full-match for a word in the name of a party to the judgment.
120+
- name: judge
121+
required: false
122+
in: query
123+
schema:
124+
type: string
125+
description: |
126+
A full-match for a word in the name of a judge or similar involved in the judgment
127+
- name: order
128+
required: false
129+
in: query
130+
schema:
131+
type: string
132+
enum:
133+
- date
134+
- "-date"
135+
- updated
136+
- "-updated"
137+
- transformation
138+
- "-transformation"
139+
default: "-date"
140+
description: |
141+
Which of the dates within the document to use for ordering. Prepend a `-` to sort by newest first.
142+
143+
- `date`: The date the document was first published by the court
144+
- `updated`: The last date the document was updated in the Find Case Law system, including changes to its metadata
145+
- `transformation`: The date the body of the document was last modified, including changes to either the body text, XML markup, or both
146+
- name: page
147+
required: false
148+
in: query
149+
schema:
150+
type: integer
151+
default: 1
152+
minimum: 1
153+
description: "Where results are across multiple pages, the page of results to return."
154+
- name: per_page
155+
required: false
156+
in: query
157+
schema:
158+
type: integer
159+
default: 50
160+
description: |
161+
How many results to list per page.
162+
responses:
163+
"200":
164+
$ref: "#/components/responses/documentFeed"
165+
tags:
166+
- Reading documents
167+
66168
"/{court}/{subdivision}/{year}/atom.xml":
67169
get:
68170
summary: Get a list of recently published or updated documents
69171
description: |
172+
Deprecated -- will now redirect to /atom.xml with relevant parameters
173+
70174
Less specific feeds can be gained by omitting the components e.g. `/`, `/2022/`, `/ewhc/` and `/ewhc/ch/` are all valid prefixes to `atom.xml`.
71175
72176
Note that a `{court}` is required if there is a `{subdivision}`.
@@ -100,10 +204,16 @@ paths:
100204
minimum: 1
101205
description: "Where results are across multiple pages, the page of results to return."
102206
responses:
103-
"200":
104-
$ref: "#/components/responses/judgmentFeed"
207+
"301":
208+
description: Moved Permanently
209+
headers:
210+
location:
211+
schema:
212+
type: string
213+
description: "https://caselaw.nationalarchives.gov.uk/atom.xml?court={court}/{subdivision}&year={year}&order=-date&page=1"
105214
tags:
106215
- Reading documents
216+
deprecated: true
107217
parameters:
108218
- name: court
109219
required: true
@@ -132,7 +242,7 @@ paths:
132242
operationId: getDocumentByUri
133243
responses:
134244
"200":
135-
$ref: "#/components/responses/judgment"
245+
$ref: "#/components/responses/document"
136246
tags:
137247
- Reading documents
138248
description: Retrieve the XML of a single document based on its identifier.

scripts/preview-priv-api-docs

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
npx @redocly/cli preview-docs doc/openapi/privileged_api.yml

scripts/preview-public-api-docs

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
npx @redocly/cli preview-docs doc/openapi/public_api.yml

0 commit comments

Comments
 (0)