You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have started looking into another project that I am supposed to add some features to. This project is using 409 Conflict to convey that a unique constraint has failed. In past I have used 400 BadRequest and now 422 Unprocessable entity to indicate failures of unique constraint. I am not sure if use of 409 Conflict for this purpose is right?
The text was updated successfully, but these errors were encountered:
I think it depends on context. 409 indicates that data you passed in valid but conflicts with the current state of the resource. So 422 is certainly more generally applicable, but 409 might work. I guess I see 409 being most suitable for when you are trying to update an existing resource and it was updated before you got to it (ie in a state machine, if you were trying to update to state 2, but something else already has done so). That said, I think either could probably work (but I would avoid 409 for creating a new resource, 422 seems better to me there).
I have started looking into another project that I am supposed to add some features to. This project is using
409 Conflict
to convey that a unique constraint has failed. In past I have used400 BadRequest
and now422 Unprocessable entity
to indicate failures of unique constraint. I am not sure if use of409 Conflict
for this purpose is right?The text was updated successfully, but these errors were encountered: