Here's a situation I have a hard time sorting out. What code should you use when you receive a valid HTTP request but you can't process it because, say, a required parameter is missing? I would say a 200 (the HTTP request itself was well-formed and went fine) which returns an error message.
I guess it's more complicated than that.
I know that Github returns either a 400 or a 422, but that's if the request itself had a problem, right? http://developer.github.com/v3/
I believe by your description, 400 would be the correct header. A missing, required parameter is bad syntax.
400 Bad Request
The request cannot be fulfilled due to bad syntax.
However, 422 could also be used.
422 Unprocessable Entity
The request was well-formed but was unable to be followed due to semantic errors.
What if there is an error, say, with the database? Which code should it be?
500 Internal Server Error
This topic is now closed. New replies are no longer allowed.