Skip to content

Commit 3f579df

Browse files
NPA-5357: Add UUID to location header for POST
1 parent 48965e9 commit 3f579df

File tree

3 files changed

+13
-2
lines changed

3 files changed

+13
-2
lines changed

sandbox/api/post_questionnaire_response.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
)
1111
from .utils import generate_response_from_example
1212

13+
QUESTIONNAIRE_RESPONSE_APP_BASE_PATH = "https://sandbox.api.service.nhs.uk/validated-relationships/FHIR/R4/QuestionnaireResponse"
1314
basicConfig(level=INFO, format="%(asctime)s - %(message)s")
1415
logger = getLogger(__name__)
1516

@@ -29,7 +30,8 @@ def post_questionnaire_response_response() -> Union[dict, tuple]:
2930

3031
# Successful questionnaire response
3132
if source_identifier in ["9000000009", "9000000017"]:
32-
response = generate_response_from_example(POST_QUESTIONNAIRE_RESPONSE__SUCCESS, 200)
33+
header = {"location": f"{QUESTIONNAIRE_RESPONSE_APP_BASE_PATH}?ID=156e1560-e532-4e2a-85ad-5aeff03dc43e"}
34+
response = generate_response_from_example(POST_QUESTIONNAIRE_RESPONSE__SUCCESS, 200, headers=header)
3335
# Duplicate relationship
3436
elif source_identifier == "9000000049":
3537
response = generate_response_from_example(POST_QUESTIONNAIRE_RESPONSE__DUPLICATE_RELATIONSHIP_ERROR, 409)

specification/examples/responses/GET_QuestionnaireResponse/success.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ GetQuestionnaireResponseSuccess:
55
resourceType: QuestionnaireResponse
66
status: "completed"
77
authored: "2024-07-15T09:43:03.280Z"
8+
id: "156e1560-e532-4e2a-85ad-5aeff03dc43e"
9+
identifier:
10+
value: "19318ZGLAB"
811
source:
912
type: "RelatedPerson"
1013
identifier:

specification/validated-relationships-service-api.yaml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,13 @@ paths:
238238
$ref: "./examples/requests/POST_QuestionnaireResponse/duplicate_relationship.yaml#/QuestionnaireResponseDuplicateRelationship"
239239
responses:
240240
"200":
241-
description: Request was received successfully for processing
241+
description: Request was received successfully for processing
242+
headers:
243+
location:
244+
schema:
245+
type: string
246+
example: https://sandbox.api.service.nhs.uk/validated-relationships/FHIR/R4/QuestionnaireResponse?ID=156e1560-e532-4e2a-85ad-5aeff03dc43e
247+
description: URL for the newly created access request
242248
content:
243249
application/fhir+json:
244250
schema:

0 commit comments

Comments
 (0)