From 0e94460ee541952cdeaccb77fa31d7bb06a2bd74 Mon Sep 17 00:00:00 2001 From: alex-dzeda <120701369+alex-dzeda@users.noreply.github.com> Date: Tue, 9 Apr 2024 12:06:11 -0500 Subject: [PATCH] BCDA-7867: Add 429 recommendations (#193) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## 🎫 Ticket https://jira.cms.gov/browse/BCDA-7867 ## πŸ›  Changes Added best practices section to "Building Your Application" page, with first best practice being handling 429 status codes. ## ℹ️ Context for reviewers BCDA has two 429 mechanisms, neither of which currently shows recommendations on how to avoid / handle them. By clearly outlining how we recommend clients handle them, we can improve the quality of the BCDA experience and decrease the number of posts that require triaging in the google group. ## βœ… Acceptance Validation ![image](https://github.com/CMSgov/bcda-static-site/assets/120701369/65df1e5a-f73d-42a2-98a5-b6d72688cc39) ## πŸ”’ Security Implications - [ ] This PR adds a new software dependency or dependencies. - [ ] This PR modifies or invalidates one or more of our security controls. - [ ] This PR stores or transmits data that was not stored or transmitted before. - [ ] This PR requires additional review of its security implications for other reasons. If any security implications apply, add Jason Ashbaugh (GitHub username: StewGoin) as a reviewer and do not merge this PR without his approval. --------- Co-authored-by: Alex Dzeda --- _includes/build/best_practices_429.html | 8 ++++++ _includes/build/requesting_data_runouts.html | 7 ++--- build.html | 28 ++++++++++++++++++++ 3 files changed, 40 insertions(+), 3 deletions(-) create mode 100644 _includes/build/best_practices_429.html diff --git a/_includes/build/best_practices_429.html b/_includes/build/best_practices_429.html new file mode 100644 index 0000000..33a8833 --- /dev/null +++ b/_includes/build/best_practices_429.html @@ -0,0 +1,8 @@ +
+

A status code of 429 indicates β€œToo Many Requests.” This can occur due to two reasons:

+
    +
  1. Making too many HTTP requests within a period of time
  2. +
  3. Trying to recreate jobs already marked as "In-Progress.” For reference, you can view both existing and past jobs using the /jobs endpoint. See Request Jobs History for more details.
  4. +
+

Regardless of the reason, you will see a Retry-After response in the header. Wait until the period of time specified in the header has passed before making any more requests. This makes sure your client can adapt without manual intervention, even if the rate-limiting parameters change.

+
\ No newline at end of file diff --git a/_includes/build/requesting_data_runouts.html b/_includes/build/requesting_data_runouts.html index 153fbcf..68bcf20 100644 --- a/_includes/build/requesting_data_runouts.html +++ b/_includes/build/requesting_data_runouts.html @@ -61,9 +61,10 @@

Start a Job using 'runout' with /Group Explanation

If the request was successful, a 202 Accepted response code will be returned and the response will include a Content-Location header. The value of the Content-Location header indicates the location to check for job status and outcome. In the example header above, the number 42 in the URL represents the ID of the export job. The claims returned in the job will be filtered to have a serviceDate of 12/31/2020 or before.

-

- If you're already requesting data from one endpoint and try to request data from that endpoint again while the first request is processing, you'll receive a 429 Too Many Requests error. -

+

+ If you're already requesting data from one endpoint and try to request data from that endpoint again while the first request is processing, you'll receive a 429 Too Many Requests error. For guidance on how to handle 429 errors, refer to our best practices. +

+

Step 3: Check the job status

See Step 3: Check the job status in the Request Data section above.

diff --git a/build.html b/build.html index 04a97f1..f6a7118 100644 --- a/build.html +++ b/build.html @@ -116,6 +116,20 @@ + + +
  • + + Best Practices + + +
  • @@ -266,6 +280,20 @@

    + +
    +

    + Best Practices +

    +
    +

    + Handling 429 status codes +

    +
    + {% include build/best_practices_429.html %} +
    +
    +
    \ No newline at end of file