202 Accepted and a status URL for anything that takes seconds
If you hold an HTTP connection open for a thirty second job, something between the client and you will time it out. Accept the job instead, say where to check on it, and do the work outside the request.
POST /exports → 202 Accepted, Location: /exports/8f2a
GET /exports/8f2a → 200 { status: "running" } … { status: "done", url: … }The client polls or subscribes. The job also survives a dropped connection, which the synchronous version never could.
httpapi-design