Imagine the following situation:
- You have an HTML sign up form for a user.
- One of the fields is for the user’s email.
- The user fills in the data and POSTs the response to the server.
- The server rejects the request, perhaps the email address is already taken.
Is there an appropriate HTTP status code for this? It seems to me this falls into the 4xx range since the client provided invalid data. Its not a 400 though since the server understood the request. And none of the other 4xx codes seem to fit.
Any ideas? Or am I trying to misuse HTTP status codes?
Update – I’ve happily found my answer. A similar problem was posted by Jan Algermissen on the Yahoo Rest discussion list. Bill de hora answered use a new HTTP status code, 418. And in response to that, Roy Fielding, one of the authors of HTTP specification, asked if he should standardize it. Yes please.
Now, let’s see what happens when I try this trick with the browsers.