All Questions
Api Design medium

A video processing API takes 5 minutes to complete. The client calls POST /videos/process. What's the best response pattern?

  1. A Keep the HTTP connection open for the full 5-minute duration to ensure the client receives the final success or failure message synchronously.
  2. B Return a 202 Accepted status with a background job ID and a status endpoint, allowing the client to poll for completion or receive a webhook.
  3. C Immediately return a 200 OK status to the client and assume the underlying storage layer will eventually achieve consistency once the task is finished.
  4. D Abort the request with an error code, as RESTful APIs are strictly designed for synchronous operations that complete within standard proxy timeout limits.

One system design question a day, with spaced repetition so the ones you miss come back.

Get the app

Related questions