Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CCM6126 respond with a json:api format for 413 errors #752

Merged
merged 32 commits into from
Oct 7, 2024

Conversation

adadigital
Copy link
Contributor

@adadigital adadigital commented Sep 27, 2024

Summary

This branch adds steps to verification which checks for the number of messages in a batch request and responds with a 413 error. This branch also translates 413 errors we receive from the backend and applies enrichment to the error message to supply them in a JSON:API format.

When the backend returns a 413 error apigee translates it as follows:

ada@LPT6442:~/project/communications-manager-api$ ./dorequest.sh

                {
                    "errors" : [
                        {
                            "id" : "rrt-5683536801484454434-a-geu2-73008-27453-1.0",
                            "code" : "CM_TOO_LARGE",
                            "links" : {
                                "about" : "https://digital.nhs.uk/developer/api-catalogue/nhs-notify"
                            },
                            "status" : "413",
                            "title" : "Request too large",
                            "detail" : "Request message was larger than the service limit",
                            "source" : {
                                "header" : "Accept"
                            }
                        }
                    ]
                }

When we submit 45001 or more messages in a request, we get the following type of response instead

< HTTP/1.1 413 Request Entity Too Large
< Date: Tue, 01 Oct 2024 11:16:24 GMT
< Content-Type: application/vnd.api+json
< Content-Length: 339
< Connection: keep-alive
< Cache-Control: no-cache, no-store, must-revalidate
< X-Content-Type-Options: nosniff
< X-Correlation-Id: rrt-4649626478417060869-c-geu2-6571-27116169-1
< Strict-Transport-Security: max-age=31536000; includeSubDomains
<
* Connection #0 to host internal-dev.api.service.nhs.uk left intact
{"errors":[{"id":"rrt-4649626478417060869-c-geu2-6571-27116169-1.0","code":"CM_TOO_MANY_ITEMS","links":{"about":"https://digital.nhs.uk/developer/api-catalogue/nhs-notify"},"status":"413","title":"Too many items","detail":"The property at the specified location contains too many items.","source":{"pointer":"/data/attributes/messages"}}]}

Reviews Required

  • Dev
  • Test
  • Tech Author
  • Product Owner

Checklist

  • Brief description of work completed, and any technical decisions made as part of the PR
  • PR link added as a comment to the relevant JIRA ticket
  • PR link shared on Slack and/or Teams
  • 2 reviews received
  • Tester approval

@adadigital adadigital merged commit da1cb4d into release Oct 7, 2024
6 checks passed
@adadigital adadigital deleted the ccm6126-message-batch-limits branch October 7, 2024 12:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants