Bhanu
Bhanu

Reputation: 419

Correct HTTP status code for PUT/POST method that does not update the document

I have a HTTP PUT/POST method to update a document in the database. However, in certain conditions (for example, the input transaction timestamp is less than the timestamp on the document), the PUT/POST method does not apply the update. What is the appropriate HTTP status code to return in such cases, to notify the caller that the update did not happen?

Upvotes: 0

Views: 60

Answers (1)

Griggs
Griggs

Reputation: 150

Look at the answer here

Ideally, you should return a 400 status code (bad request) with a message indicating why the request failed. This allows anyone using your API to understand why the request was not successful.

Upvotes: 1

Related Questions