Skip to content

Commit 9808541

Browse files
Merge branch 'master' into task/NPA-5608/consent-id-spec-fixes
2 parents d9d26e5 + cab6ad1 commit 9808541

18 files changed

+446
-395
lines changed

postman/Validated Relationship Service Sandbox.postman_collection.json

Lines changed: 43 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
{
22
"info": {
3-
"_postman_id": "9c6dfa73-ac4f-4497-bca6-c2c4048f7c10",
4-
"name": "Validated Relationship Service Sandbox 29/09/25",
3+
"_postman_id": "5c759d0a-d924-44ab-8668-3587dcaf27e1",
4+
"name": "Validated Relationship Service Sandbox 14/10/25",
55
"description": "This Postman collection includes example scenarios for each of the Validated Relationship Service (VRS) API endpoints, covering both valid and invalid request scenarios.\n\nThe collection is pointed towards the VRS sandbox environment, which will return a specific example response based on the request sent. All data shown in the requests or responses is test data.\n\nOur sandbox environment only covers the scenarios listed in the Postman collection and is open access. It does not allow you to test authorisation or any scenarios beyond the ones documented.\n\nFull specification is available at [https://digital.nhs.uk/developer/api-catalogue/validated-relationship-service](https://digital.nhs.uk/developer/api-catalogue/validated-relationship-service)",
66
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json",
7-
"_exporter_id": "48873809",
8-
"_collection_link": "https://www.postman.com/christopher-bacon1-3957569/workspace/validated-relationship-service-sandbox-29-09-2025/collection/48873809-9c6dfa73-ac4f-4497-bca6-c2c4048f7c10?action=share&source=collection_link&creator=48873809"
7+
"_exporter_id": "18067099",
8+
"_collection_link": "https://www.postman.com/lunar-crescent-672573/workspace/validated-relationship-service-14-10-2025/collection/18067099-5c759d0a-d924-44ab-8668-3587dcaf27e1?action=share&source=collection_link&creator=18067099"
99
},
1010
"item": [
1111
{
@@ -235,18 +235,13 @@
235235
}
236236
],
237237
"url": {
238-
"raw": "{{api_base_url}}/QuestionnaireResponse?ID=156e1560-e532-4e2a-85ad-5aeff03dc43e",
238+
"raw": "{{api_base_url}}/QuestionnaireResponse/156e1560-e532-4e2a-85ad-5aeff03dc43e",
239239
"host": [
240240
"{{api_base_url}}"
241241
],
242242
"path": [
243-
"QuestionnaireResponse"
244-
],
245-
"query": [
246-
{
247-
"key": "ID",
248-
"value": "156e1560-e532-4e2a-85ad-5aeff03dc43e"
249-
}
243+
"QuestionnaireResponse",
244+
"156e1560-e532-4e2a-85ad-5aeff03dc43e"
250245
]
251246
},
252247
"description": "Example of Questionnaire Response that will be returned"
@@ -261,27 +256,28 @@
261256
"script": {
262257
"exec": [
263258
"const expectedResponseBody = {",
264-
" \"resourceType\": \"OperationOutcome\",",
265259
" \"issue\": [",
266260
" {",
267-
" \"severity\": \"error\",",
268-
" \"code\": \"required\",",
261+
" \"code\": \"not-supported\",",
269262
" \"details\": {",
270263
" \"coding\": [",
271264
" {",
272-
" \"system\": \"https://fhir.nhs.uk/STU3/CodeSystem/Spine-ErrorOrWarningCode-1\",",
273-
" \"code\": \"BAD_REQUEST\",",
274-
" \"display\": \"Bad request\"",
265+
" \"code\": \"METHOD_NOT_ALLOWED\",",
266+
" \"display\": \"The method is not allowed.\",",
267+
" \"system\": \"https://fhir.nhs.uk/R4/CodeSystem/ValidatedRelationships-ErrorOrWarningCode\",",
268+
" \"version\": \"1\"",
275269
" }",
276270
" ]",
277271
" },",
278-
" \"diagnostics\": \"The access request ID parameter is required but was not provided.\"",
272+
" \"diagnostics\": \"The method is not allowed for the requested resource.\",",
273+
" \"severity\": \"error\"",
279274
" }",
280-
" ]",
275+
" ],",
276+
" \"resourceType\": \"OperationOutcome\"",
281277
"};",
282278
"",
283-
"pm.test(\"Status code is 400\", function () {",
284-
" pm.response.to.have.status(400);",
279+
"pm.test(\"Status code is 405\", function () {",
280+
" pm.response.to.have.status(405);",
285281
"});",
286282
"",
287283
"pm.test(\"Should have correct response body\", () => {",
@@ -309,12 +305,13 @@
309305
}
310306
],
311307
"url": {
312-
"raw": "{{api_base_url}}/QuestionnaireResponse",
308+
"raw": "{{api_base_url}}/QuestionnaireResponse/",
313309
"host": [
314310
"{{api_base_url}}"
315311
],
316312
"path": [
317-
"QuestionnaireResponse"
313+
"QuestionnaireResponse",
314+
""
318315
]
319316
},
320317
"description": "Example of an error response when reference code is missing from request"
@@ -377,18 +374,13 @@
377374
}
378375
],
379376
"url": {
380-
"raw": "{{api_base_url}}/QuestionnaireResponse?ID=INVALID",
377+
"raw": "{{api_base_url}}/QuestionnaireResponse/INVALID",
381378
"host": [
382379
"{{api_base_url}}"
383380
],
384381
"path": [
385-
"QuestionnaireResponse"
386-
],
387-
"query": [
388-
{
389-
"key": "ID",
390-
"value": "INVALID"
391-
}
382+
"QuestionnaireResponse",
383+
"INVALID"
392384
]
393385
},
394386
"description": "Example of an error response when reference code is invalid"
@@ -451,18 +443,13 @@
451443
}
452444
],
453445
"url": {
454-
"raw": "{{api_base_url}}/QuestionnaireResponse?ID=60d09b82-f4bb-41f9-b41e-767999b4ac9b",
446+
"raw": "{{api_base_url}}/QuestionnaireResponse/60d09b82-f4bb-41f9-b41e-767999b4ac9b",
455447
"host": [
456448
"{{api_base_url}}"
457449
],
458450
"path": [
459-
"QuestionnaireResponse"
460-
],
461-
"query": [
462-
{
463-
"key": "ID",
464-
"value": "60d09b82-f4bb-41f9-b41e-767999b4ac9b"
465-
}
451+
"QuestionnaireResponse",
452+
"60d09b82-f4bb-41f9-b41e-767999b4ac9b"
466453
]
467454
},
468455
"description": "Example of an error response when reference code is not found in database"
@@ -2126,7 +2113,7 @@
21262113
" \"meta\": {",
21272114
" \"security\": [",
21282115
" {",
2129-
" \"system\": \"https://fhir.nhs.uk/CodeSystem/NHSIdentityProofingLevel\",",
2116+
" \"system\": \"https://fhir.nhs.uk/England/CodeSystem/England-NHSIdentityProofingLevel\",",
21302117
" \"code\": \"P9\",",
21312118
" \"display\": \"High level verification (P9)\"",
21322119
" }",
@@ -2300,7 +2287,7 @@
23002287
" \"meta\": {",
23012288
" \"security\": [",
23022289
" {",
2303-
" \"system\": \"https://fhir.nhs.uk/CodeSystem/NHSIdentityProofingLevel\",",
2290+
" \"system\": \"https://fhir.nhs.uk/England/CodeSystem/England-NHSIdentityProofingLevel\",",
23042291
" \"code\": \"P9\",",
23052292
" \"display\": \"High level verification (P9)\"",
23062293
" }",
@@ -3438,7 +3425,7 @@
34383425
" \"meta\": {",
34393426
" \"security\": [",
34403427
" {",
3441-
" \"system\": \"https://fhir.nhs.uk/CodeSystem/NHSIdentityProofingLevel\",",
3428+
" \"system\": \"https://fhir.nhs.uk/England/CodeSystem/England-NHSIdentityProofingLevel\",",
34423429
" \"code\": \"P9\",",
34433430
" \"display\": \"High level verification (P9)\"",
34443431
" }",
@@ -3575,7 +3562,7 @@
35753562
" \"meta\": {",
35763563
" \"security\": [",
35773564
" {",
3578-
" \"system\": \"https://fhir.nhs.uk/CodeSystem/NHSIdentityProofingLevel\",",
3565+
" \"system\": \"https://fhir.nhs.uk/England/CodeSystem/England-NHSIdentityProofingLevel\",",
35793566
" \"code\": \"P9\",",
35803567
" \"display\": \"High level verification (P9)\"",
35813568
" }",
@@ -3708,7 +3695,7 @@
37083695
" \"meta\": {",
37093696
" \"security\": [",
37103697
" {",
3711-
" \"system\": \"https://fhir.nhs.uk/CodeSystem/NHSIdentityProofingLevel\",",
3698+
" \"system\": \"https://fhir.nhs.uk/England/CodeSystem/England-NHSIdentityProofingLevel\",",
37123699
" \"code\": \"P9\",",
37133700
" \"display\": \"High level verification (P9)\"",
37143701
" }",
@@ -4368,7 +4355,7 @@
43684355
" \"meta\": {",
43694356
" \"security\": [",
43704357
" {",
4371-
" \"system\": \"https://fhir.nhs.uk/CodeSystem/NHSIdentityProofingLevel\",",
4358+
" \"system\": \"https://fhir.nhs.uk/England/CodeSystem/England-NHSIdentityProofingLevel\",",
43724359
" \"code\": \"P9\",",
43734360
" \"display\": \"High level verification (P9)\"",
43744361
" }",
@@ -4542,7 +4529,7 @@
45424529
" \"meta\": {",
45434530
" \"security\": [",
45444531
" {",
4545-
" \"system\": \"https://fhir.nhs.uk/CodeSystem/NHSIdentityProofingLevel\",",
4532+
" \"system\": \"https://fhir.nhs.uk/England/CodeSystem/England-NHSIdentityProofingLevel\",",
45464533
" \"code\": \"P9\",",
45474534
" \"display\": \"High level verification (P9)\"",
45484535
" }",
@@ -4712,7 +4699,7 @@
47124699
" \"meta\": {",
47134700
" \"security\": [",
47144701
" {",
4715-
" \"system\": \"https://fhir.nhs.uk/CodeSystem/NHSIdentityProofingLevel\",",
4702+
" \"system\": \"https://fhir.nhs.uk/England/CodeSystem/England-NHSIdentityProofingLevel\",",
47164703
" \"code\": \"P9\",",
47174704
" \"display\": \"High level verification (P9)\"",
47184705
" }",
@@ -5206,7 +5193,7 @@
52065193
" \"meta\": {",
52075194
" \"security\": [",
52085195
" {",
5209-
" \"system\": \"https://fhir.nhs.uk/CodeSystem/NHSIdentityProofingLevel\",",
5196+
" \"system\": \"https://fhir.nhs.uk/England/CodeSystem/England-NHSIdentityProofingLevel\",",
52105197
" \"code\": \"P9\",",
52115198
" \"display\": \"High level verification (P9)\"",
52125199
" }",
@@ -6101,7 +6088,7 @@
61016088
" \"meta\": {",
61026089
" \"security\": [",
61036090
" {",
6104-
" \"system\": \"https://fhir.nhs.uk/CodeSystem/NHSIdentityProofingLevel\",",
6091+
" \"system\": \"https://fhir.nhs.uk/England/CodeSystem/England-NHSIdentityProofingLevel\",",
61056092
" \"code\": \"P9\",",
61066093
" \"display\": \"High level verification (P9)\"",
61076094
" }",
@@ -6684,7 +6671,7 @@
66846671
" \"meta\": {",
66856672
" \"security\": [",
66866673
" {",
6687-
" \"system\": \"https://fhir.nhs.uk/CodeSystem/NHSIdentityProofingLevel\",",
6674+
" \"system\": \"https://fhir.nhs.uk/England/CodeSystem/England-NHSIdentityProofingLevel\",",
66886675
" \"code\": \"P9\",",
66896676
" \"display\": \"High level verification (P9)\"",
66906677
" }",
@@ -7066,7 +7053,7 @@
70667053
" \"meta\": {",
70677054
" \"security\": [",
70687055
" {",
7069-
" \"system\": \"https://fhir.nhs.uk/CodeSystem/NHSIdentityProofingLevel\",",
7056+
" \"system\": \"https://fhir.nhs.uk/England/CodeSystem/England-NHSIdentityProofingLevel\",",
70707057
" \"code\": \"P9\",",
70717058
" \"display\": \"High level verification (P9)\"",
70727059
" }",
@@ -8140,7 +8127,7 @@
81408127
" \"meta\": {",
81418128
" \"security\": [",
81428129
" {",
8143-
" \"system\": \"https://fhir.nhs.uk/CodeSystem/NHSIdentityProofingLevel\",",
8130+
" \"system\": \"https://fhir.nhs.uk/England/CodeSystem/England-NHSIdentityProofingLevel\",",
81448131
" \"code\": \"P9\",",
81458132
" \"display\": \"High level verification (P9)\"",
81468133
" }",
@@ -8494,7 +8481,7 @@
84948481
" \"meta\": {",
84958482
" \"security\": [",
84968483
" {",
8497-
" \"system\": \"https://fhir.nhs.uk/CodeSystem/NHSIdentityProofingLevel\",",
8484+
" \"system\": \"https://fhir.nhs.uk/England/CodeSystem/England-NHSIdentityProofingLevel\",",
84988485
" \"code\": \"P9\",",
84998486
" \"display\": \"High level verification (P9)\"",
85008487
" }",
@@ -8821,7 +8808,7 @@
88218808
" \"meta\": {",
88228809
" \"security\": [",
88238810
" {",
8824-
" \"system\": \"https://fhir.nhs.uk/CodeSystem/NHSIdentityProofingLevel\",",
8811+
" \"system\": \"https://fhir.nhs.uk/England/CodeSystem/England-NHSIdentityProofingLevel\",",
88258812
" \"code\": \"P9\",",
88268813
" \"display\": \"High level verification (P9)\"",
88278814
" }",
@@ -9191,7 +9178,7 @@
91919178
" \"meta\": {",
91929179
" \"security\": [",
91939180
" {",
9194-
" \"system\": \"https://fhir.nhs.uk/CodeSystem/NHSIdentityProofingLevel\",",
9181+
" \"system\": \"https://fhir.nhs.uk/England/CodeSystem/England-NHSIdentityProofingLevel\",",
91959182
" \"code\": \"P9\",",
91969183
" \"display\": \"High level verification (P9)\"",
91979184
" }",

sandbox/api/app.py

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,13 @@
55

66
from .get_consent import get_consent_response
77
from .get_consent_by_id import get_consent_by_id_response
8-
from .get_questionnaire_response import get_questionnaire_response_response
8+
from .get_questionnaire_response_by_path_id import get_questionnaire_response_by_path_id_response
99
from .get_related_person import get_related_person_response
1010
from .patch_consent import patch_consent_response
1111
from .post_consent import post_consent_response
1212
from .post_questionnaire_response import post_questionnaire_response_response
13+
from .utils import generate_response_from_example
14+
from .constants import METHOD_NOT_ALLOWED
1315

1416
app = Flask(__name__)
1517
basicConfig(level=INFO, format="%(asctime)s - %(message)s")
@@ -40,13 +42,24 @@ def get_related_persons() -> Union[dict, tuple]:
4042

4143

4244
@app.route(f"/{COMMON_PATH}/QuestionnaireResponse", methods=["GET"])
45+
@app.route(f"/{COMMON_PATH}/QuestionnaireResponse/", methods=["GET"])
4346
def get_questionnaire_response() -> Union[dict, tuple]:
4447
"""Sandbox API for GET /QuestionnaireResponse
4548
4649
Returns:
4750
Union[dict, tuple]: Response for GET /QuestionnaireResponse
4851
"""
49-
return get_questionnaire_response_response()
52+
return generate_response_from_example(METHOD_NOT_ALLOWED, 405)
53+
54+
55+
@app.route(f"/{COMMON_PATH}/QuestionnaireResponse/<identifier>", methods=["GET"])
56+
def get_questionnaire_response_id(identifier: str) -> Union[dict, tuple]:
57+
"""Sandbox API for GET /QuestionnaireResponse
58+
59+
Returns:
60+
Union[dict, tuple]: Response for GET /QuestionnaireResponse
61+
"""
62+
return get_questionnaire_response_by_path_id_response(identifier)
5063

5164

5265
@app.route(f"/{COMMON_PATH}/QuestionnaireResponse", methods=["POST"])

sandbox/api/constants.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
INVALIDATED_RESOURCE = "./api/examples/errors/invalidated-resource.yaml"
1515
MISSING_IDENTIFIER = "./api/examples/errors/missing-identifier.yaml"
1616
INVALID_IDENTIFIER = "./api/examples/errors/invalid-identifier.yaml"
17+
METHOD_NOT_ALLOWED = "./api/examples/errors/method-not-allowed.yaml"
1718

1819
# GET Consent examples
1920
GET_CONSENT__DIRECTORY = "./api/examples/GET_Consent/"

sandbox/api/get_questionnaire_response.py renamed to sandbox/api/get_questionnaire_response_by_path_id.py

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,32 @@
11
from logging import INFO, basicConfig, getLogger
22
from typing import Union
33

4-
from flask import request
5-
64
from .constants import (
75
GET_QUESTIONNAIRE_RESPONSE__INVALID,
8-
GET_QUESTIONNAIRE_RESPONSE__MISSING,
96
GET_QUESTIONNAIRE_RESPONSE__NOT_FOUND,
107
GET_QUESTIONNAIRE_RESPONSE__SUCCESS,
118
INTERNAL_SERVER_ERROR_EXAMPLE,
9+
METHOD_NOT_ALLOWED,
1210
)
1311
from .utils import generate_response_from_example
1412

1513
basicConfig(level=INFO, format="%(asctime)s - %(message)s")
1614
logger = getLogger(__name__)
1715

1816

19-
def get_questionnaire_response_response() -> Union[dict, tuple]:
20-
"""Sandbox API for GET /QuestionnaireResponse
17+
def get_questionnaire_response_by_path_id_response(access_request_id: str) -> Union[dict, tuple]:
18+
"""Sandbox API for GET /QuestionnaireResponse/{id}
2119
2220
Returns:
23-
Union[dict, tuple]: Response for GET /QuestionnaireResponse
21+
Union[dict, tuple]: Response for GET /QuestionnaireResponse/{id}
2422
"""
2523
try:
26-
access_request_id = request.args.get("ID")
2724
if access_request_id == "156e1560-e532-4e2a-85ad-5aeff03dc43e":
2825
return generate_response_from_example(GET_QUESTIONNAIRE_RESPONSE__SUCCESS, 200)
2926
elif access_request_id == "INVALID":
3027
return generate_response_from_example(GET_QUESTIONNAIRE_RESPONSE__INVALID, 400)
3128
elif access_request_id == "" or access_request_id is None:
32-
return generate_response_from_example(GET_QUESTIONNAIRE_RESPONSE__MISSING, 400)
29+
return generate_response_from_example(METHOD_NOT_ALLOWED, 405)
3330
elif access_request_id == "60d09b82-f4bb-41f9-b41e-767999b4ac9b":
3431
return generate_response_from_example(GET_QUESTIONNAIRE_RESPONSE__NOT_FOUND, 404)
3532
else:

0 commit comments

Comments
 (0)