Bird
Raised Fist0

You receive this Problem Details JSON:

hard🚀 Application Q9 of Q15
Rest API - Error Handling
You receive this Problem Details JSON:
{"type": "https://example.com/probs/timeout", "title": "Request Timeout", "status": 408, "detail": "The request took too long.", "retry-after": 120}

Is this response valid according to RFC 7807, and what does the retry-after field represent?
AInvalid; <code>retry-after</code> must be inside <code>detail</code>
BValid; <code>retry-after</code> is a custom field indicating seconds to wait before retrying
CValid; <code>retry-after</code> is a required standard field
DInvalid; custom fields are not allowed in Problem Details
Step-by-Step Solution
Solution:
  1. Step 1: Check RFC 7807 allowance for custom fields

    RFC 7807 allows adding custom fields at the top level, so retry-after is valid.
  2. Step 2: Understand retry-after meaning

    This field indicates how many seconds the client should wait before retrying the request.
  3. Final Answer:

    Valid; retry-after is a custom field indicating seconds to wait before retrying -> Option B
  4. Quick Check:

    Custom fields allowed; retry-after = wait time [OK]
Quick Trick: Custom fields allowed; use them for extra info like retry time [OK]
Common Mistakes:
MISTAKES
  • Thinking custom fields must be inside detail
  • Assuming retry-after is standard required field
  • Believing custom fields are disallowed

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Rest API Quizzes