Re:JSend: a specification for how JSON responses should be f...
by adamjernst on Sunday February 27, 2011 @01:37AM
(#2267425)
Who said you can't include an entity body with a 422 status? e.g.:
HTTP/1.1 422 Unprocessable Entity
{"error": "email address must contain @", "applies_to": "email_field"}
I don't know if this proposal is optimal (smarter guys than me can decide that). But I know that a standard way of communicating application-specific errors would be a big step forward.
A year ago I searched for an adequate in-place editing plugin for Rails that didn't require major surgery to provide error messages to the user. I was surprised at the complexity required to handle a simple error condition. Usually Rails has all the goodness baked in but it seems application-specific status messages with JSON are out of scope. I asked "How to show server errors in Rails with JSON and jQuery" [1] on Stack Overflow and it's received more views than any other question I've ever asked.
[1] http://stackoverflow.com/questions/2489567/how-to-show-serve...