Skip to content

Commit 0da3c05

Browse files
authored
Merge pull request #213 from NHSDigital/dev/NPA-5086_Consent_Id_OAS
NPA-5086 Add GET /Consent/{id} endpoint
2 parents c18c872 + 6d975df commit 0da3c05

File tree

5 files changed

+129
-2
lines changed

5 files changed

+129
-2
lines changed

.github/workflows/openapi-validate.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ jobs:
4040
name: "GET /Questionnaire",
4141
make_target: "schema-get-questionnaire",
4242
},
43-
{ name: "Errors", make_target: "schema-errors" },
43+
{ name: "Errors", make_target: "schema-errors" }
4444
]
4545
steps:
4646
- name: Checkout repository

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,4 +148,4 @@ schema-get-questionnaire:
148148
echo "Processing $$file"; \
149149
poetry run python scripts/validate_schema.py questionnaireresponse "$$(realpath $$file)"; \
150150
echo -e "$(GREEN)Success!$(RESET)"; \
151-
done
151+
done
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
ConsentInvalidIDError:
2+
summary: Invalid ID
3+
description: Error raised due to an invalid ID request path being specified.
4+
value:
5+
issue:
6+
- code: invalid
7+
diagnostics: "Invalid request with error - ID must be a valid UUID."
8+
details:
9+
coding:
10+
- code: "INVALID_ID_VALUE"
11+
display: "Required parameter(s) are invalid."
12+
system: "https://fhir.nhs.uk/R4/CodeSystem/ValidatedRelationships-ErrorOrWarningCode"
13+
version: "1"
14+
severity: error
15+
resourceType: "OperationOutcome"
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
ConsentMissingIDError:
2+
summary: Missing ID
3+
description: Error raised due to an missing ID in the request path.
4+
value:
5+
issue:
6+
- code: invalid
7+
diagnostics: "Invalid request with error - ID must be specified in the request path."
8+
details:
9+
coding:
10+
- code: "MISSING_ID_VALUE"
11+
display: "Required parameter(s) are missing."
12+
system: "https://fhir.nhs.uk/R4/CodeSystem/ValidatedRelationships-ErrorOrWarningCode"
13+
version: "1"
14+
severity: error
15+
resourceType: "OperationOutcome"

specification/validated-relationships-service-api.yaml

Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -734,6 +734,90 @@ paths:
734734
$ref: "./examples/responses/errors/downstream-service-error.yaml#/DownstreamServiceError"
735735

736736
/Consent/{id}:
737+
get:
738+
summary: Get proxy roles
739+
description: |
740+
## Overview
741+
Use this endpoint to get the details of a proxy role, including current status, based on a provided id.
742+
743+
You can (optionally) include the `_include=Consent:performer` request parameter to include the proxy's details in the response.
744+
745+
You can (optionally) include the `_include=Consent:patient` request parameter to include the patient's details in the response.
746+
747+
operationId: get-consent-by-id
748+
parameters:
749+
- $ref: "#/components/parameters/BearerAuthorization"
750+
- $ref: "#/components/parameters/ConsentID"
751+
- $ref: "#/components/parameters/ConsentBundleIncludes"
752+
- $ref: "#/components/parameters/RequestID"
753+
- $ref: "#/components/parameters/CorrelationID"
754+
responses:
755+
"200":
756+
description: Information successfully returned.
757+
content:
758+
application/fhir+json:
759+
schema:
760+
$ref: "#/components/schemas/ConsentBundle"
761+
examples:
762+
ConsentSingleConsentingAdultRelationshipBundle:
763+
$ref: "./examples/responses/GET_Consent/single-consenting-adult-relationship.yaml#/ConsentSingleConsentingAdultRelationshipBundle"
764+
ConsentSingleConsentingAdultRelationshipIncludePerformerPatientBundle:
765+
$ref: "./examples/responses/GET_Consent/single-consenting-adult-relationship-include-performer-patient.yaml#/ConsentSingleConsentingAdultRelationshipIncludePerformerPatientBundle"
766+
ConsentSingleAdultChildRelationshipBundle:
767+
$ref: "./examples/responses/GET_Consent/single-mother-child-relationship.yaml#/ConsentSingleAdultChildRelationshipBundle"
768+
ConsentSingleAdultChildRelationshipIncludePerformerPatientBundle:
769+
$ref: "./examples/responses/GET_Consent/single-mother-child-relationship-include-performer-patient.yaml#/ConsentSingleAdultChildRelationshipIncludePerformerPatientBundle"
770+
771+
"4XX":
772+
description: |
773+
Errors will be returned for the first error encountered in the request. An error occurred as follows:
774+
775+
| HTTP status | Error code | Description |
776+
| ----------- | -------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------- |
777+
| 400 | `MISSING_VALUE` | Missing header or parameter. For details, see the `diagnostics` field. |
778+
| 400 | `INVALID_VALUE` | Invalid header. For details, see the `diagnostics` field. |
779+
| 400 | `MISSING_ID_VALUE` | Missing id. |
780+
| 400 | `NOT_SUPPORTED` | The request is not currently supported. |
781+
| 401 | `ACCESS_DENIED` | Missing or invalid OAuth 2.0 bearer token in request. |
782+
| 403 | `FORBIDDEN` | Access denied to resource. |
783+
| 404 | `INVALIDATED_RESOURCE` | Resource that has been marked as invalid was requested - invalid resources cannot be retrieved |
784+
| 405 | `METHOD_NOT_ALLOWED` | The method is not allowed. |
785+
| 408 | `TIMEOUT` | Request timed out. |
786+
| 422 | `INVALID_ID_SYSTEM` | Invalid id. |
787+
| 429 | `THROTTLED` | You have exceeded your application's [rate limit](https://digital.nhs.uk/developer/guides-and-documentation/reference-guide#rate-limits). |
788+
789+
content:
790+
application/fhir+json:
791+
schema:
792+
$ref: "#/components/schemas/OperationOutcome"
793+
examples:
794+
AccessDeniedError:
795+
$ref: "./examples/responses/errors/access-denied.yaml#/AccessDeniedError"
796+
InvalidatedResourceError:
797+
$ref: "./examples/responses/errors/invalidated-resource.yaml#/InvalidatedResourceError"
798+
MissingIdError:
799+
$ref: "./examples/responses/GET_Consent/ID/errors/missing-id.yaml#/ConsentMissingIDError"
800+
InvalidIdError:
801+
$ref: "./examples/responses/GET_Consent/ID/errors/invalid-id.yaml#/ConsentInvalidIDError"
802+
"5XX":
803+
description: |
804+
Errors will be returned for the first error encountered in the request. An error occurred as follows:
805+
806+
| HTTP status | Error code | Description |
807+
| ----------- | -------------------------- | ------------------------------------------------------------ |
808+
| 500 | `SERVER_ERROR` | An unexpected internal server error has occurred. |
809+
| 502 | `GATEWAY_ERROR` | Connection to the backend service failed. |
810+
| 503 | `DOWNSTREAM_SERVICE_ERROR` | A downsteam service has failed, request cannot be completed. |
811+
812+
content:
813+
application/fhir+json:
814+
schema:
815+
$ref: "#/components/schemas/OperationOutcome"
816+
examples:
817+
InternalServerError:
818+
$ref: "./examples/responses/errors/internal-server-error.yaml#/InternalServerError"
819+
DownstreamServiceError:
820+
$ref: "./examples/responses/errors/downstream-service-error.yaml#/DownstreamServiceError"
737821
patch:
738822
summary: Update a proxy role
739823
description: |
@@ -769,6 +853,7 @@ paths:
769853
| Resource not found | Patch for non-existent Consent, request with an id not listed here | HTTP Status 404 and RESOURCE_NOT_FOUND error response |
770854
| Invalid state transition | Patch attempting invalid status change, request with id '6fb4361b' | HTTP Status 422 and INVALID_STATE_TRANSITION error response |
771855
parameters:
856+
# Change id parameter to Component ConsentID when NPA-5088 is complete
772857
- name: id
773858
in: path
774859
required: true
@@ -890,6 +975,7 @@ paths:
890975
$ref: "./examples/responses/errors/internal-server-error.yaml#/InternalServerError"
891976
DownstreamServiceError:
892977
$ref: "./examples/responses/errors/downstream-service-error.yaml#/DownstreamServiceError"
978+
893979
components:
894980
schemas:
895981
QuestionnaireResponse:
@@ -2560,3 +2646,14 @@ components:
25602646
type: string
25612647
pattern: "^[^;]+;[^;]+$"
25622648
example: NiV3CyMJH3xYV26ghlVpbbjT7pDVEA8HpFczAjRLTs1VezC4CYzupZ3XxXAWM7ELuseqrV8r0Ill7EL7G2tXUaVHCPWgg4q10+MxFjnRPrjDvckBRSZazqZcp0K2VBdUV0rZ7RUYJNJsjVAeefWhiK/Y4R+GFO86QDpt41JS9xA=;G123456
2649+
2650+
ConsentID:
2651+
in: path
2652+
name: id
2653+
required: true
2654+
description: The logical id of the Consent resource
2655+
schema:
2656+
type: string
2657+
format: uuid
2658+
pattern: "^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$"
2659+
example: 11C46F5F-CDEF-4865-94B2-0EE0EDCC26DA

0 commit comments

Comments
 (0)