Agreed, the codes are a crap-shoot. We are working on a redesign of our API and I've pushed for always returning a 200 with a defined JSON structure of something along the lines of:
{
"status": true
"data": { ... }
}
for success and {
"status": false
"errorCode": 123,
"errorMessage": " ... " //Only shown in dev/debug mode
}
for failures.We haven't nailed it all down yet but there was no way I was going to do HTTP status codes for some things and some JSON errorCodes for others. It needed to be all or nothing and since HTTP codes obviously wouldn't satisfy it was 200's everywhere...