views:

19

answers:

1

... due to server-side rules.

Specifically, I have comments that nest, and I am forbidding the deletion of comments with children.

So when someone requests:

DELETE /comments/5

where the 5th comment has children, I do not allow the comment to be deleted. What is the appropriate HTTP status code? I use a 405 elsewhere on the site, but that doesn't appear appropriate here. Nor is a 401 appropriate in cases where the user WOULD have rights to delete the comment (for instance if the user owns the comment), if it weren't for the children.

+1  A: 

How about sending 409. It translates to The request could not be completed due to a conflict with the current state of the resource.

Teja Kantamneni
Ahh, I've reread the specification and agree with your assessment of the situation. Thanks!
Steven Xu
Link to RFC definition of 409 Conflict: http://tools.ietf.org/html/rfc2616#section-10.4.10
Day