0

What HTTP status code should be sent to the user if his post request is correct but the process got stuck in decision-making(should be made by the client) situation and the client should call the same request again with one of the new values send back from the app to complete the request?

2 Answers 2

0

So considering that in this case there is no success or failure it definitely discards 2xx, 4xx and 5xx statuses. My opinion is that 300 Multiple Choices should be used, here's the quote from Wikipedia article on HTTP codes.

300 Multiple Choices Indicates multiple options for the resource from which the client may choose (via agent-driven content negotiation). For example, this code could be used to present multiple video format options, to list files with different filename extensions, or to suggest word-sense disambiguation.[19]

In the article you can find more details on how does client choose additional options in the following request.

Sign up to request clarification or add additional context in comments.

Comments

0

With a question like this, a good place to start the implications of cache-invalidation.

A cache MUST invalidate the effective Request URI... when a non-error status code is received in response to an unsafe request method.

So returning a 2xx or 3xx status code informs a general purpose client that all previously cached representations of the target resource should be invalidated. When a 4xx or 5xx status code is returned, general purpose clients will assume that the target resource is unchanged.

So: for cases where the document is unchanged because the request didn't have enough information, you want a 4xx status code. For cases where the document has changed (perhaps to some "not quite done" state), you want a 2xx status code.

In the successful case, you'll want to use 200 Success or 201 Created; the choice depends on whether or not new resources have been created (for instance, new resources that help the client to finish the editing process).

For the unsuccessful cases, I'd recommend 422 Unprocessible Entity

The 422 (Unprocessable Entity) status code means the server understands the content type of the request entity (hence a 415(Unsupported Media Type) status code is inappropriate), and the syntax of the request entity is correct (thus a 400 (Bad Request) status code is inappropriate) but was unable to process the contained instructions. For example, this error condition may occur if an XML request body contains well-formed (i.e., syntactically correct), but semantically erroneous, XML instructions.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.