Rest API - Error HandlingYou want to implement a rate limit error response that tells clients to retry after 2 minutes. Which is the correct HTTP response?AHTTP/1.1 429 Too Many Requests\nRetry-After: 2 minutesBHTTP/1.1 429 Too Many Requests\nRetry-After: two minutesCHTTP/1.1 429 Too Many Requests\nRetry-After: 00:02:00DHTTP/1.1 429 Too Many Requests\nRetry-After: 120Check Answer
Step-by-Step SolutionSolution:Step 1: Understand Retry-After header formatRetry-After accepts seconds as integer or HTTP-date format, not text or time strings.Step 2: Choose correct format for 2 minutes2 minutes equals 120 seconds, so 'Retry-After: 120' is correct.Final Answer:HTTP/1.1 429 Too Many Requests\nRetry-After: 120 -> Option DQuick Check:Retry-After in seconds = 120 [OK]Quick Trick: Use seconds or HTTP-date in Retry-After header [OK]Common Mistakes:MISTAKESUsing text like '2 minutes' instead of secondsUsing time format like 00:02:00 incorrectlyWriting words instead of numbers
Master "Error Handling" in Rest API9 interactive learning modes - each teaches the same concept differentlyLearnWhyDeepVisualTryChallengeProjectRecallTime
More Rest API Quizzes Authentication and Authorization - OAuth 2.0 overview - Quiz 7medium Authentication and Authorization - Client credentials flow - Quiz 4medium Authentication and Authorization - Client credentials flow - Quiz 10hard HATEOAS and Linking - Action links for state transitions - Quiz 15hard Pagination Patterns - Link headers for navigation - Quiz 12easy Rate Limiting and Throttling - Fixed window algorithm - Quiz 3easy Rate Limiting and Throttling - Rate limit headers (X-RateLimit) - Quiz 5medium Versioning Strategies - Media type versioning - Quiz 5medium Versioning Strategies - Header-based versioning - Quiz 9hard Versioning Strategies - Versioning best practices - Quiz 6medium