|
|
|
|
|
by treis
1432 days ago
|
|
>I think 200 means something exists and 404 is the representation of non-existence. But that's not what the spec says: >200 OK - The request has succeeded. The information returned with the response is dependent on the method used in the request, for example: > GET an entity corresponding to the requested resource is sent in the response; >The 404 (Not Found) status code indicates that the origin server did not find a current representation for the target resource or is not willing to disclose that one exists. 404 is not the representation of non-existence. It's the representation of not found. Something can be "not found" for many more reasons than non-existence. Which ultimately causes the person integrating your API much consternation because they have no idea if it's a "Everything worked" 404 or "My DNS is borked" 404 or "Your server's routing is borked" 404 or half a dozen other possibilities. Sure, you might add further information to your 404 response but that means you can't have generic 404=bad monitoring. Plus causes headaches for people that are working in systems that do assume 404=bad. 200 means that the request has succeeded. And in these cases it has. You requested a representation of employee 100 and you're getting one (it doesn't exist). Even if you disagree with the word smithing the latter is far far easier to work with. |
|