wtf( )unctionsystem design, drawn
← all problemsAPI DesignMedium

Three failures, three different codes

A client integration keeps retrying requests that will never succeed, and giving up on ones that would have worked a second later. Every failure from this API returns 400.

A status code is a contract about what the caller should do next. Collapsing every failure into one code destroys that information, so the client has no way to tell "fix your request" from "try again shortly".

Give each of these three failures the code that tells the client what to do.
Components — tap one, then tap a slot on the diagram
!The client retries requests that can never succeed, and abandons ones that would have worked.

Outside every boundary: No token (not signed in), Over quota (too many requests), Missing field (malformed body), API (answers 400 to all three; FAILED: 400 for everything), an empty slot for the retrying won't help, an empty slot for the retry once signed in, an empty slot for the retry later, unchanged Connections: Missing field calls retrying won't help (step 1) No token calls retry once signed in (step 2) Over quota calls retry later, unchanged (step 3) retry later, unchanged calls API

No tokennot signed in
Over quotatoo many requests
Missing fieldmalformed body
APIanswers 400 to all three400 for everything