user824624
user824624

Reputation: 8056

what is the restful service http code for update failure

I am building a restful service, I know the http code from http://www.restapitutorial.com/httpstatuscodes.html

However I don't find the http code in corresponding to update something failed with HTTP PUT operation?

Upvotes: 6

Views: 12224

Answers (1)

mjk
mjk

Reputation: 2453

Take a look at the actual RFC 2616 that enumerates HTTP response codes.

They have two specific recommendations:

  • If the entity being PUT included changes to a resource which conflict with those made by an earlier (third-party) request, return 409 Conflict, with a list of the differences between the two versions in the response body

  • Return 400 Bad Request for an otherwise unsuccessful PUT, with an explanation of why it failed (in plain old English) in the response body

Upvotes: 6

Related Questions