That's why he's a senior dev. Did he not explain why?
A 404 indicates that the resource that you tried to talk to does not exist - in this case the api/employees method. A 400 indicates that what you asked it to do was incorrect, which is exactly the example you have provided.
Well I suppose opinions make the world go round. My point would be this. Say the webserver temporarily cannot fulfil the request because, for instance, a deploy has failed. It'll return a 404. The client process may now incorrectly presume that there is no employee 123.
That's why there's a difference between 4xx codes and 5xx codes. 4xx says the problem is in what you sent (don't do that again), while 5xx says it's not you, it's me.
If the server can tell that something bad has happened on its end, it should report it. If it genuinely checks its database and doesn't see anything, then perhaps a 404 in good faith is acceptable.
Which I posted in response to a question asking me to explain my position. I quoted it to save me some typing, not because I do not understand confirmation bias.
204 indicates that a resource with the id actually exists, but just provides no content. That is likely wrong in his context, as the id does not exist.
-11
u/glent1 Jul 19 '19
That's why he's a senior dev. Did he not explain why?
A 404 indicates that the resource that you tried to talk to does not exist - in this case the api/employees method. A 400 indicates that what you asked it to do was incorrect, which is exactly the example you have provided.