Skip to content

Commit 30bf487

Browse files
author
Brad Morton
committed
add 400 error information
1 parent 96f4cdd commit 30bf487

1 file changed

Lines changed: 90 additions & 11 deletions

File tree

specification/nhs-website-content-api.yaml

Lines changed: 90 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -64,10 +64,9 @@ info:
6464
You need to sign up via the developer hub to recieve your API key. Additional onboarding information exists on the [developer hub](https://digital.nhs.uk//developer/api-catalogue/nhs-syndicated-content/onboarding-support-information)
6565
6666
## Errors
67-
We have standard error codes for 200 to 299 if it succeeded, including code 202 if it was accepted by an API that needs to wait for further action
67+
We have standard error codes for 200 to 299 if it succeeded, including code 202 if it was accepted by an API that needs to wait for further action.
6868
69-
Currently, our Akamai cache provides errors in the form of a webpage.
70-
In future we plan to serve error codes via the API.
69+
We have error codes for 400 to 422 to aid with debugging any potential issues
7170
7271
Errors specific to each endpoint are shown in the endpoints section, under response. See our [reference guide](https://digital.nhs.uk/developer/guides-and-documentation/reference-guide#http-status-codes) for more on errors.
7372
@@ -113,7 +112,7 @@ paths:
113112
| status | Filter by "published" or "unpublished" | string |
114113
115114
responses:
116-
"200":
115+
'200':
117116
description: |
118117
A valid query for the conditions.
119118
headers:
@@ -125,6 +124,16 @@ paths:
125124
$ref: components/schemas/WebPage.json
126125
example:
127126
$ref: components/examples/ConditionsHealthAToZ.json
127+
'4XX':
128+
description: |
129+
An error occurred as follows:
130+
131+
| HTTP status | Error code | Description |
132+
| ----------- | -------------------------- | --------------------------------------------- |
133+
| 401 | ACCESS_DENIED | ApiKey missing, invalid or expired, or calling application not configured for this operation. |
134+
| 403 | ACCESS_DENIED | User cannot perform this action. |
135+
| 404 | RESOURCE_NOT_FOUND | Page not found. |
136+
| 429 | TOO_MANY_REQUESTS | You have exceeded your application's [rate limit](https://digital.nhs.uk/developer/guides-and-documentation/reference-guide#rate-limits). |
128137
/conditions/*:
129138
parameters:
130139
- $ref: "#/components/parameters/apiKey"
@@ -147,7 +156,7 @@ paths:
147156
# Modularisation
148157
We modularise some of our content, meaning that individual parts of the page can be reused. If a page is modularised, content appears in the `hasPart` field.
149158
responses:
150-
"200":
159+
'200':
151160
description: |
152161
A valid query which returns a page object for the chosen page
153162
headers:
@@ -159,6 +168,16 @@ paths:
159168
$ref: components/schemas/WebPage.json
160169
example:
161170
$ref: components/examples/ConditionsContentPage.json
171+
'4XX':
172+
description: |
173+
An error occurred as follows:
174+
175+
| HTTP status | Error code | Description |
176+
| ----------- | -------------------------- | --------------------------------------------- |
177+
| 401 | ACCESS_DENIED | ApiKey missing, invalid or expired, or calling application not configured for this operation. |
178+
| 403 | ACCESS_DENIED | User cannot perform this action. |
179+
| 404 | RESOURCE_NOT_FOUND | Page not found. |
180+
| 429 | TOO_MANY_REQUESTS | You have exceeded your application's [rate limit](https://digital.nhs.uk/developer/guides-and-documentation/reference-guide#rate-limits). |
162181
/medicines:
163182
parameters:
164183
- $ref: "#/components/parameters/apiKey"
@@ -199,7 +218,7 @@ paths:
199218
for example `https://api.nhs.uk/medicines?apiKey=xxx&startDate=2022-01-01&orderBy=dateModified`
200219
201220
responses:
202-
"200":
221+
'200':
203222
description: |
204223
A valid query for medicines.
205224
headers:
@@ -211,6 +230,16 @@ paths:
211230
$ref: components/schemas/WebPage.json
212231
example:
213232
$ref: components/examples/MedicinesAToZ.json
233+
'4XX':
234+
description: |
235+
An error occurred as follows:
236+
237+
| HTTP status | Error code | Description |
238+
| ----------- | -------------------------- | --------------------------------------------- |
239+
| 401 | ACCESS_DENIED | ApiKey missing, invalid or expired, or calling application not configured for this operation. |
240+
| 403 | ACCESS_DENIED | User cannot perform this action. |
241+
| 404 | RESOURCE_NOT_FOUND | Page not found. |
242+
| 429 | TOO_MANY_REQUESTS | You have exceeded your application's [rate limit](https://digital.nhs.uk/developer/guides-and-documentation/reference-guide#rate-limits). |
214243
/medicines/*:
215244
parameters:
216245
- $ref: "#/components/parameters/apiKey"
@@ -223,7 +252,7 @@ paths:
223252
224253
This can be used to get specific information about individual medicines.
225254
responses:
226-
"200":
255+
'200':
227256
description: |
228257
A valid query for medicines.
229258
headers:
@@ -235,6 +264,16 @@ paths:
235264
$ref: components/schemas/WebPage.json
236265
example:
237266
$ref: components/examples/MedicinesContentPage.json
267+
'4XX':
268+
description: |
269+
An error occurred as follows:
270+
271+
| HTTP status | Error code | Description |
272+
| ----------- | -------------------------- | --------------------------------------------- |
273+
| 401 | ACCESS_DENIED | ApiKey missing, invalid or expired, or calling application not configured for this operation. |
274+
| 403 | ACCESS_DENIED | User cannot perform this action. |
275+
| 404 | RESOURCE_NOT_FOUND | Page not found. |
276+
| 429 | TOO_MANY_REQUESTS | You have exceeded your application's [rate limit](https://digital.nhs.uk/developer/guides-and-documentation/reference-guide#rate-limits). |
238277
/mental-health:
239278
parameters:
240279
- $ref: "#/components/parameters/apiKey"
@@ -251,7 +290,7 @@ paths:
251290
At the top level, modularised content of child pages is highlighted by the `hasPart` field. In child pages, only the individual page will be shown.
252291
253292
responses:
254-
"200":
293+
'200':
255294
description: |
256295
A valid query for the mental health hub.
257296
headers:
@@ -263,6 +302,16 @@ paths:
263302
$ref: components/schemas/WebPage.json
264303
example:
265304
$ref: components/examples/MentalHealthHubPage.json
305+
'4XX':
306+
description: |
307+
An error occurred as follows:
308+
309+
| HTTP status | Error code | Description |
310+
| ----------- | -------------------------- | --------------------------------------------- |
311+
| 401 | ACCESS_DENIED | ApiKey missing, invalid or expired, or calling application not configured for this operation. |
312+
| 403 | ACCESS_DENIED | User cannot perform this action. |
313+
| 404 | RESOURCE_NOT_FOUND | Page not found. |
314+
| 429 | TOO_MANY_REQUESTS | You have exceeded your application's [rate limit](https://digital.nhs.uk/developer/guides-and-documentation/reference-guide#rate-limits). |
266315
/pregnancy:
267316
parameters:
268317
- $ref: "#/components/parameters/apiKey"
@@ -279,7 +328,7 @@ paths:
279328
At the top level, child modularised content is highlighted by the `hasPart` field. In child pages, only the individual page will be highlighted
280329
281330
responses:
282-
"200":
331+
'200':
283332
description: |
284333
A valid query for the pregnancy hub.
285334
headers:
@@ -291,6 +340,16 @@ paths:
291340
$ref: components/schemas/WebPage.json
292341
example:
293342
$ref: components/examples/PregnancyHubPage.json
343+
'4XX':
344+
description: |
345+
An error occurred as follows:
346+
347+
| HTTP status | Error code | Description |
348+
| ----------- | -------------------------- | --------------------------------------------- |
349+
| 401 | ACCESS_DENIED | ApiKey missing, invalid or expired, or calling application not configured for this operation. |
350+
| 403 | ACCESS_DENIED | User cannot perform this action. |
351+
| 404 | RESOURCE_NOT_FOUND | Page not found. |
352+
| 429 | TOO_MANY_REQUESTS | You have exceeded your application's [rate limit](https://digital.nhs.uk/developer/guides-and-documentation/reference-guide#rate-limits). |
294353
/common-health-questions:
295354
parameters:
296355
- $ref: "#/components/parameters/apiKey"
@@ -307,7 +366,7 @@ paths:
307366
Content pages use the 'question' schema.org [question](https://schema.org/Question) property.
308367
309368
responses:
310-
"200":
369+
'200':
311370
description: |
312371
A valid query for the common health questions pages.
313372
headers:
@@ -319,6 +378,16 @@ paths:
319378
$ref: components/schemas/WebPage.json
320379
example:
321380
$ref: components/examples/CommonHealthQuestionsHubPage.json
381+
'4XX':
382+
description: |
383+
An error occurred as follows:
384+
385+
| HTTP status | Error code | Description |
386+
| ----------- | -------------------------- | --------------------------------------------- |
387+
| 401 | ACCESS_DENIED | ApiKey missing, invalid or expired, or calling application not configured for this operation. |
388+
| 403 | ACCESS_DENIED | User cannot perform this action. |
389+
| 404 | RESOURCE_NOT_FOUND | Page not found. |
390+
| 429 | TOO_MANY_REQUESTS | You have exceeded your application's [rate limit](https://digital.nhs.uk/developer/guides-and-documentation/reference-guide#rate-limits). |
322391
/live-well:
323392
parameters:
324393
- $ref: "#/components/parameters/apiKey"
@@ -334,7 +403,7 @@ paths:
334403
335404
At the top level, modularised content of child pages is highlighted by the `hasPart` field. In child pages, only the individual page will be shown.
336405
responses:
337-
"200":
406+
'200':
338407
description: |
339408
A valid query for the Live Well pages.
340409
headers:
@@ -346,6 +415,16 @@ paths:
346415
$ref: components/schemas/WebPage.json
347416
example:
348417
$ref: components/examples/LiveWellHubPage.json
418+
'4XX':
419+
description: |
420+
An error occurred as follows:
421+
422+
| HTTP status | Error code | Description |
423+
| ----------- | -------------------------- | --------------------------------------------- |
424+
| 401 | ACCESS_DENIED | ApiKey missing, invalid or expired, or calling application not configured for this operation. |
425+
| 403 | ACCESS_DENIED | User cannot perform this action. |
426+
| 404 | RESOURCE_NOT_FOUND | Page not found. |
427+
| 429 | TOO_MANY_REQUESTS | You have exceeded your application's [rate limit](https://digital.nhs.uk/developer/guides-and-documentation/reference-guide#rate-limits). |
349428
components:
350429
headers:
351430
apiKey:

0 commit comments

Comments
 (0)