Bird
0
0

You want to create a Problem Details response for a rate limit error. Which JSON object correctly follows RFC 7807 and clearly informs the client about the error?

hard📝 Application Q15 of 15
Rest API - Error Handling
You want to create a Problem Details response for a rate limit error. Which JSON object correctly follows RFC 7807 and clearly informs the client about the error?
A{"type": "rate-limit", "title": "Error", "status": 429, "detail": "Limit reached"}
B{"title": "Rate limit exceeded", "status": "429", "detail": "Too many requests", "instance": "/api/v1/resource"}
C{"type": "https://example.com/probs/rate-limit", "title": "Rate limit exceeded", "status": 429, "detail": "You have sent too many requests in a short time.", "instance": "/api/v1/resource"}
D{"type": "https://example.com/probs/rate-limit", "title": "Rate limit exceeded", "status": 200, "detail": "Too many requests"}
Step-by-Step Solution
Solution:
  1. Step 1: Check required fields and correct types

    {"type": "https://example.com/probs/rate-limit", "title": "Rate limit exceeded", "status": 429, "detail": "You have sent too many requests in a short time.", "instance": "/api/v1/resource"} includes 'type' as a URI, 'title', numeric 'status' 429, 'detail', and 'instance' fields correctly.
  2. Step 2: Validate status code and clarity

    Status 429 means Too Many Requests, matching the error. Other options have missing or wrong fields or wrong status codes.
  3. Final Answer:

    {"type": "https://example.com/probs/rate-limit", "title": "Rate limit exceeded", "status": 429, "detail": "You have sent too many requests in a short time.", "instance": "/api/v1/resource"} -> Option C
  4. Quick Check:

    Correct fields and status = {"type": "https://example.com/probs/rate-limit", "title": "Rate limit exceeded", "status": 429, "detail": "You have sent too many requests in a short time.", "instance": "/api/v1/resource"} [OK]
Quick Trick: Use URI in 'type' and correct numeric 'status' [OK]
Common Mistakes:
  • Using string instead of number for status
  • Missing 'type' or using non-URI string
  • Wrong HTTP status code for error

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Rest API Quizzes