Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

HTTP Response code for "Please wait a little bit"

What is the best HTTP response code for the server to send if it wants the client to wait for a little bit of time and then try the request again?

Right now, I'm using:

409 Conflict

But this doesn't feel quite right...

like image 522
Chris Dutrow Avatar asked Sep 16 '12 18:09

Chris Dutrow


People also ask

What does HTTP 205 mean?

The HTTP 205 Reset Content response status tells the client to reset the document view, so for example to clear the content of a form, reset a canvas state, or to refresh the UI.

What does a HTTP 200 response status mean?

The HTTP 200 OK success status response code indicates that the request has succeeded. A 200 response is cacheable by default. The meaning of a success depends on the HTTP request method: GET : The resource has been fetched and is transmitted in the message body.

What is HTTP error1?

The server does not support, or refuses to support, the HTTP protocol version that was used in the request message. The server is indicating that it is unable or unwilling to complete the request using the same major version as the client, as described in section 3.1, other than with this error message.

What is 5xx HTTP codes refer?

5xx Status Codes. A 5xx code means the problem was caused by the server. With a 5xx code, the request can be present with no changes and you will get the requested result when the server has been fixed. With a 4xx code, typically the client or user has to fix an error before trying again, but there are some exceptions.


1 Answers

Depending on why you want them to wait, the status codes will be different. Codes that start with 4 signify client errors. If the request was done properly I would not use a 400 code. Statuses that start with 5 are for server errors. If you are asking the HTTP requestor to wait because of problems on your side, I'd go with 503.

I came across this issue writing a web service to check if a file is finished processing. If it is done. I am returning 200, if it is not I don't want to give an error code. It would be more appropriate to use one that starts with 2 (success.) In this case the best standard code would probably be "202 Accepted" The HTTP spec describes it as:

The request has been accepted for processing, but the processing has not been completed.

like image 93
Chris Broski Avatar answered Sep 21 '22 09:09

Chris Broski