DEV Community

Discussion on: The HTTP Status Codes You Need to Know

Collapse
 
markmichon profile image
Mark Michon

When creating a resource, ideally you'd have some mechanism in place to dynamically generate the unique references(ID, etc).

If, however, you're creating user accounts bound to a user id or email, you may run into a scenario like the one you've mentioned. In that case, the 409 seems more appropriate if you want to avoid the generic 400. I wouldn't use 406.

Collapse
 
reritom profile image
Tomas Sheers

This is what I would expect, but Coreys reply makes sense too. I wonder if there is some specification for this, or what the general consensus is.

I've worked with a few REST APIs and most haven't been consistent in this regard.