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/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/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/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 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"