200-901 Understanding and Using APIs Practice Question
A network automation engineer is writing a Python script that calls the Cisco DNA Center API to retrieve device health scores. The API enforces rate limiting and returns HTTP 429 with a 'Retry-After' header when the limit is exceeded. The script must handle this gracefully without crashing. Which code pattern correctly implements the retry logic?
⚠ Common exam trap
The trap here is treating a 429 response like a generic error and retrying immediately, instead of using the server-provided 'Retry-After' header to determine the correct backoff period.
Answer choices
Why each option matters
Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.
Correct answer & explanation
✓
Check the response status code; if it is 429, read the 'Retry-After' header, sleep for the specified number of seconds, then retry the request.
When an API returns HTTP 429 Too Many Requests, it often includes a 'Retry-After' header specifying how long the client should wait before retrying. The script must check for this status code, extract the header, pause for the indicated duration, and then retry the request. This ensures compliance with rate limits and maintains the script's reliability without causing further throttling.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
Ignore the 429 response and continue with the next API call, assuming the data will be fetched eventually.
Why it's wrong here
Ignoring a 429 response means the request failed and no data was retrieved. Continuing without the data can cause downstream errors or incomplete results. The script must handle the error by waiting and retrying to obtain the required health scores. Simply skipping the call does not fulfill the automation's purpose and may lead to silent failures.
- ✗
Use a try-except block to catch requests.exceptions.HTTPError, then immediately retry the request in a loop until it succeeds.
Why it's wrong here
Catching the HTTPError and retrying immediately without delay ignores the 'Retry-After' header and can exacerbate rate limiting, potentially leading to a longer ban. A proper implementation must respect the server's suggested wait time. Immediate retries in a tight loop are considered abusive and can cause the API to block the client permanently.
- ✓
Check the response status code; if it is 429, read the 'Retry-After' header, sleep for the specified number of seconds, then retry the request.
Why this is correct
The correct approach is to detect the 429 status, parse the 'Retry-After' header (which indicates how many seconds to wait), pause execution using time.sleep(), and then retry. This respects the server's rate limit policy and ensures the script does not overwhelm the API. It also prevents unnecessary errors and aligns with standard practices for handling rate limiting in REST APIs.
- ✗
Increase the request timeout value to 60 seconds and resend the request, hoping the rate limit resets.
Why it's wrong here
Adjusting the timeout does not address rate limiting; the server will still reject the request if the limit is exceeded. The 'Retry-After' header provides the exact wait time needed. Ignoring it and resending immediately or with a longer timeout will likely result in another 429. Proper handling requires reading and honoring the header value.
Go deeper
Related to this question
About these practice questions
Courseiva writes every 200-901 question from scratch — 975 in total, each with an explanation and a wrong-answer breakdown. None are copied from real exams or dumps. Learn why practice questions differ from exam dumps →
JA
Written and reviewed by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
Last reviewed September 2026 · checked against the official Cisco exam blueprint
This 200-901 practice question is part of Courseiva's free Cisco certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the 200-901 exam.