QA
Intermediate LevelREST APIs & Web Services

How does the Asynchronous Request-Reply Pattern work with HTTP 202 Accepted?

❓ Interview Prompt: Explain Asynchronous Request-Reply Pattern, `202 Accepted` status, `Location` status polling header, background worker queues, and webhook completion.

When an API request initiates a long-running operation (e.g. video encoding, PDF generation taking > 30 seconds), keeping HTTP connections open causes timeouts:

Asynchronous Request-Reply Pattern:

1
Client submits request: 'POST /api/v1/reports'.
2
Server queues job in RabbitMQ/Redis and immediately returns '202 Accepted' with header: 'Location: /api/v1/jobs/job_99'.
3
Client polls 'GET /api/v1/jobs/job_99' until status changes from 'PENDING' to 'COMPLETED'!

Code Implementation Example

http
HTTP/1.1 202 Accepted
Location: /api/v1/jobs/job_99
Content-Type: application/json

{
  "jobId": "job_99",
  "status": "PROCESSING",
  "estimatedTimeSeconds": 45
}
💡HTTP 202 Accepted response providing job location polling URL.
🎯 Interview Key Takeaway

Use HTTP 202 Accepted with a Location header for long-running operations to allow clients to poll job progress asynchronously.

#202 Accepted#Async Request-Reply#Background Jobs#Intermediate
Back to all REST APIs & Web Services Questions→

More REST APIs & Web Services Interview Questions

Beginner LevelREST APIs & Web Services

What is HTTP Method Idempotency and how do you implement Idempotency Keys for REST APIs?

Beginner LevelREST APIs & Web Services

What are standard HTTP Status Codes (200, 201, 204, 400, 401, 403, 404, 409, 429, 500, 503)?

Beginner LevelREST APIs & Web Services

What are HTTP Verbs (GET, POST, PUT, PATCH, DELETE) and when to use PUT vs PATCH?