I'm working on a RESTful web API with a Hibernate powered back-end. So far, we've mapped a few error codes. For instance, when @Version validation fails, our API returns HTTP error code 409.
Now, we need to map the best error code to be returned when unique validation fails. For instance, my API has a business rule which says that there cannot be two instances of entity A with the same name. For instance, if I have a record in my DB with name = "XYZ", I cannot create another record in the database with the same name "XYZ". What would be the best return code in this case? 409 as well?
I've done some research in both "REST in Practice" book and Google, and 409 seems to be mostly associated with @Version, I couldn't any references to 409 being used with unique validations.
Any help is greatly appreciated! Thanks!