From 8c997f5a5bacd32899979b3a0d0dc913cb505178 Mon Sep 17 00:00:00 2001 From: David Wass Date: Wed, 10 Dec 2025 11:28:54 +0000 Subject: [PATCH 1/5] CCM-13554 - APIM Errors not serializing --- .../api/components/environments/int/rate-limiting.yml | 4 ++-- .../api/components/x-nhsd-apim/x-nhsd-apim.yml | 10 ++++++++++ 2 files changed, 12 insertions(+), 2 deletions(-) create mode 100644 specification/api/components/x-nhsd-apim/x-nhsd-apim.yml diff --git a/specification/api/components/environments/int/rate-limiting.yml b/specification/api/components/environments/int/rate-limiting.yml index 71900a20..31d7e4f2 100644 --- a/specification/api/components/environments/int/rate-limiting.yml +++ b/specification/api/components/environments/int/rate-limiting.yml @@ -1,3 +1,3 @@ app-default: - limit: 300 - timeunit: second + limit: 1 + timeunit: minute diff --git a/specification/api/components/x-nhsd-apim/x-nhsd-apim.yml b/specification/api/components/x-nhsd-apim/x-nhsd-apim.yml new file mode 100644 index 00000000..f86e068b --- /dev/null +++ b/specification/api/components/x-nhsd-apim/x-nhsd-apim.yml @@ -0,0 +1,10 @@ +temporary: false +monitoring: false +access: + $ref: ../environments/sandbox/access.yml +target: + $ref: ../environments/sandbox/target.yml +target-attributes: + $ref: ../environments/sandbox/target-attributes.yml +ratelimiting: + $ref: ../environments/sandbox/rate-limiting.yml From 48bae483c6ae5bad5f62c344a362b78d563bcb37 Mon Sep 17 00:00:00 2001 From: David Wass Date: Wed, 10 Dec 2025 14:33:59 +0000 Subject: [PATCH 2/5] CCM-13554 - Update 429 response --- .../errors/responses/tooManyRequests.json | 20 +++++-------- .../responses/errors/tooManyRequests.yml | 29 +++++++++++++++++-- 2 files changed, 35 insertions(+), 14 deletions(-) diff --git a/sandbox/data/examples/errors/responses/tooManyRequests.json b/sandbox/data/examples/errors/responses/tooManyRequests.json index 4babbd7d..36411d71 100644 --- a/sandbox/data/examples/errors/responses/tooManyRequests.json +++ b/sandbox/data/examples/errors/responses/tooManyRequests.json @@ -1,14 +1,10 @@ { - "errors": [ - { - "code": "NOTIFY_QUOTA", - "detail": "You have made too many requests. Please try again later.", - "id": "rrt-1931948104716186917-c-geu2-10664-3111479-3.0", - "links": { - "about": "https://digital.nhs.uk/developer/api-catalogue/nhs-notify-supplier" - }, - "status": "429", - "title": "Too many requests" - } - ] + "interval": 1, + "limit": 1, + "message": "Your application, Notify-Supplier-App-Restricted - Internal Dev 2, has exceeded its quota of 1 requests every 1 minute(s) and is being rate limited.", + "message_id": "rrt-4773181658036170775-c-geu2-321623-73628915-2", + "policy": "quota", + "ratelimiting_expiry_time_ms": 1765372560000, + "scope": "application", + "timeunit": "minute" } diff --git a/specification/api/components/responses/errors/tooManyRequests.yml b/specification/api/components/responses/errors/tooManyRequests.yml index 292735e5..86aec81b 100644 --- a/specification/api/components/responses/errors/tooManyRequests.yml +++ b/specification/api/components/responses/errors/tooManyRequests.yml @@ -1,8 +1,33 @@ description: Too many requests content: - application/vnd.api+json: + application/json: schema: - $ref: "../../schemas/errorResponse.yml" + type: object + properties: + message: + type: string + example: "Your application has exceeded its quota" + scope: + type: string + example: "application" + policy: + type: string + example: "quota" + limit: + type: integer + example: 300 + interval: + type: integer + example: 1 + timeunit: + type: string + example: "minute" + ratelimiting_expiry_time_ms: + type: integer + example: 1625498765123 + message_id: + type: string + example: "rrt-4773181658036170775-c-geu2-321623-73628915-2" examples: error-too-many-requests: $ref: ../../examples/errors/responses/tooManyRequests.json From 56c7b5554d3378ef80d1a93e205c6aebf856e0f0 Mon Sep 17 00:00:00 2001 From: David Wass Date: Wed, 17 Dec 2025 11:46:16 +0000 Subject: [PATCH 3/5] 502 error from api gateway --- .../data/examples/errors/responses/bad-gateway.json | 3 +++ specification/api/components/endpoints/createMI.yml | 2 ++ specification/api/components/endpoints/getDataId.yml | 2 ++ .../api/components/endpoints/getLetterStatus.yml | 2 ++ specification/api/components/endpoints/listLetters.yml | 2 ++ specification/api/components/endpoints/patchLetter.yml | 2 ++ specification/api/components/endpoints/postLetters.yml | 2 ++ .../api/components/responses/errors/badGateway.yml | 8 ++++++++ .../api/components/schemas/apiGatewayError.yml | 9 +++++++++ .../api/components/x-nhsd-apim/x-nhsd-apim.yml | 10 +++++----- 10 files changed, 37 insertions(+), 5 deletions(-) create mode 100644 sandbox/data/examples/errors/responses/bad-gateway.json create mode 100644 specification/api/components/responses/errors/badGateway.yml create mode 100644 specification/api/components/schemas/apiGatewayError.yml diff --git a/sandbox/data/examples/errors/responses/bad-gateway.json b/sandbox/data/examples/errors/responses/bad-gateway.json new file mode 100644 index 00000000..a125f860 --- /dev/null +++ b/sandbox/data/examples/errors/responses/bad-gateway.json @@ -0,0 +1,3 @@ +{ + "message": "Bad Gateway" +} diff --git a/specification/api/components/endpoints/createMI.yml b/specification/api/components/endpoints/createMI.yml index 04ee8664..0032ae07 100644 --- a/specification/api/components/endpoints/createMI.yml +++ b/specification/api/components/endpoints/createMI.yml @@ -15,3 +15,5 @@ responses: $ref: "../responses/errors/tooManyRequests.yml" '500': $ref: "../responses/errors/serverError.yml" + '502': + $ref: "../responses/errors/badGateway.yml" diff --git a/specification/api/components/endpoints/getDataId.yml b/specification/api/components/endpoints/getDataId.yml index c7574df4..1c5aef45 100644 --- a/specification/api/components/endpoints/getDataId.yml +++ b/specification/api/components/endpoints/getDataId.yml @@ -13,3 +13,5 @@ responses: $ref: "../responses/errors/tooManyRequests.yml" "500": $ref: "../responses/errors/serverError.yml" + "502": + $ref: "../responses/errors/badGateway.yml" diff --git a/specification/api/components/endpoints/getLetterStatus.yml b/specification/api/components/endpoints/getLetterStatus.yml index bee57b46..a7290dcf 100644 --- a/specification/api/components/endpoints/getLetterStatus.yml +++ b/specification/api/components/endpoints/getLetterStatus.yml @@ -11,5 +11,7 @@ responses: $ref: "../responses/errors/tooManyRequests.yml" "500": $ref: "../responses/errors/serverError.yml" + "502": + $ref: "../responses/errors/badGateway.yml" tags: - letter diff --git a/specification/api/components/endpoints/listLetters.yml b/specification/api/components/endpoints/listLetters.yml index 2d300c65..638f3917 100644 --- a/specification/api/components/endpoints/listLetters.yml +++ b/specification/api/components/endpoints/listLetters.yml @@ -18,3 +18,5 @@ responses: $ref: "../responses/errors/tooManyRequests.yml" '500': $ref: "../responses/errors/serverError.yml" + '502': + $ref: "../responses/errors/badGateway.yml" diff --git a/specification/api/components/endpoints/patchLetter.yml b/specification/api/components/endpoints/patchLetter.yml index 7e8775e2..61ba6dad 100644 --- a/specification/api/components/endpoints/patchLetter.yml +++ b/specification/api/components/endpoints/patchLetter.yml @@ -15,5 +15,7 @@ responses: $ref: "../responses/errors/tooManyRequests.yml" "500": $ref: "../responses/errors/serverError.yml" + "502": + $ref: "../responses/errors/badGateway.yml" tags: - letter diff --git a/specification/api/components/endpoints/postLetters.yml b/specification/api/components/endpoints/postLetters.yml index 4aeee72a..876c7fd1 100644 --- a/specification/api/components/endpoints/postLetters.yml +++ b/specification/api/components/endpoints/postLetters.yml @@ -15,3 +15,5 @@ responses: $ref: "../responses/errors/tooManyRequests.yml" '500': $ref: "../responses/errors/serverError.yml" + '502': + $ref: "../responses/errors/badGateway.yml" diff --git a/specification/api/components/responses/errors/badGateway.yml b/specification/api/components/responses/errors/badGateway.yml new file mode 100644 index 00000000..3d1cce78 --- /dev/null +++ b/specification/api/components/responses/errors/badGateway.yml @@ -0,0 +1,8 @@ +description: "Bad gateway" +content: + application/vnd.api+json: + schema: + $ref: "../../schemas/apiGatewayError.yml" + examples: + error-bad-request: + $ref: ../../examples/errors/responses/bad-gateway.json diff --git a/specification/api/components/schemas/apiGatewayError.yml b/specification/api/components/schemas/apiGatewayError.yml new file mode 100644 index 00000000..a36048f6 --- /dev/null +++ b/specification/api/components/schemas/apiGatewayError.yml @@ -0,0 +1,9 @@ +description: API gateway error response +content: + application/json: + schema: + type: object + properties: + message: + type: string + example: "Bad Gateway" diff --git a/specification/api/components/x-nhsd-apim/x-nhsd-apim.yml b/specification/api/components/x-nhsd-apim/x-nhsd-apim.yml index f86e068b..3c0310dd 100644 --- a/specification/api/components/x-nhsd-apim/x-nhsd-apim.yml +++ b/specification/api/components/x-nhsd-apim/x-nhsd-apim.yml @@ -1,10 +1,10 @@ -temporary: false +temporary: true monitoring: false access: - $ref: ../environments/sandbox/access.yml + $ref: ../environments/internal-dev-pr/access.yml target: - $ref: ../environments/sandbox/target.yml + $ref: ../environments/internal-dev-pr/target.yml target-attributes: - $ref: ../environments/sandbox/target-attributes.yml + $ref: ../environments/internal-dev-pr/target-attributes.yml ratelimiting: - $ref: ../environments/sandbox/rate-limiting.yml + $ref: ../environments/internal-dev-pr/rate-limiting.yml From 83e26aa618d0a1aece91a7d1d42495f60c27e053 Mon Sep 17 00:00:00 2001 From: David Wass Date: Thu, 18 Dec 2025 09:11:23 +0000 Subject: [PATCH 4/5] revert rate limiting --- .../api/components/environments/int/rate-limiting.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/specification/api/components/environments/int/rate-limiting.yml b/specification/api/components/environments/int/rate-limiting.yml index 31d7e4f2..71900a20 100644 --- a/specification/api/components/environments/int/rate-limiting.yml +++ b/specification/api/components/environments/int/rate-limiting.yml @@ -1,3 +1,3 @@ app-default: - limit: 1 - timeunit: minute + limit: 300 + timeunit: second From 81d2e553baa38e902b35140648e8a08010740044 Mon Sep 17 00:00:00 2001 From: David Wass Date: Thu, 18 Dec 2025 09:17:20 +0000 Subject: [PATCH 5/5] remove created yml files --- .../api/components/x-nhsd-apim/x-nhsd-apim.yml | 10 ---------- 1 file changed, 10 deletions(-) delete mode 100644 specification/api/components/x-nhsd-apim/x-nhsd-apim.yml diff --git a/specification/api/components/x-nhsd-apim/x-nhsd-apim.yml b/specification/api/components/x-nhsd-apim/x-nhsd-apim.yml deleted file mode 100644 index 3c0310dd..00000000 --- a/specification/api/components/x-nhsd-apim/x-nhsd-apim.yml +++ /dev/null @@ -1,10 +0,0 @@ -temporary: true -monitoring: false -access: - $ref: ../environments/internal-dev-pr/access.yml -target: - $ref: ../environments/internal-dev-pr/target.yml -target-attributes: - $ref: ../environments/internal-dev-pr/target-attributes.yml -ratelimiting: - $ref: ../environments/internal-dev-pr/rate-limiting.yml