202 Accepted
202 Accepted
, means that the server accepted the request, but it’s not
sure yet if the request will be completed successfully.
The specification calls it ‘intentionally non-committal’. You might see APIs using this response for for example asynchronous batch processing. HTTP doesn’t have a standard way to communicate after a request if a request eventually succeeded. An API using this might use some other facility to later to do this.
For example, it might send an email to a user telling them that the batch process worked, or it might expose another endpoint in the API that can indicates the current status of a long-running process.
Example
POST /my-batch-process HTTP/1.1
Content-Type: application/json
...
HTTP/1.1 202 Accepted
Link: </batch-status/5545> rel="http://example.org/batch-status"
Content-Length: 0