Say I want to do DELETE /groups/20
, and that my business rules state you cannot delete a group as long as it has members.
- If DELETE succeeds, I would return
200
or204
- If group 20 does not exist, I would return
404
- If the user is not authenticated, I would return
401
. - If the user is authenticated but does not have rights on group 20, I would return
403
- If group 20 exists, user is authenticated, request is fine, but you cannot delete group 20 because it contains members?
What would you return in that case? 400
? But the syntax is perfectly formed. 403
? Well, yes, it is forbidden, but 403
has come to generally mean, "you don't have the right to perform this action", as opposed to, "you have the right, but some prerequisite is not met, take care of those and then come back."