Re:Facebook Relay: An Evil And/Or Incompetent Attack on REST
by neilellis on Monday October 19, 2015 @04:13PM
(#10415383)
I think for application status codes it makes sense to always return 200 and do as you have done.
Of course, if your API has received bad data then better to return a 400 and a similar payload.
And if your application has caught an exception which is not part of any form of validation then better to return 500 and the payload.
Got to do the best we can with the hand we're dealt hey!
Re:Facebook Relay: An Evil And/Or Incompetent Attack on REST
by RussianCow on Monday October 19, 2015 @01:06PM
(#10414182)
This is what we do as well. As an added bonus, it makes writing client libraries for our API easier since error handling is more consistent. (Many HTTP libraries handle error status codes differently than 200s, which is annoying since you now have to handle errors in two places.)
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...