3 ms·
I fundamentally disagree with this as being the correct code, a http get request is give me this resource, not does this resource exist, however it is all about
by theginger 4y ago
I fundamentally disagree with this as being the correct code, a http get request is give me this resource, not does this resource exist, however it is all about context.
It is your API, it is your decision to decide if you have looked for the resource and were unable to find it, so return an error, or you have looked for the resource and found a placeholder that says there could be a resource here, but currently isn't and successfully return that placeholder.
To suggest people are wrong or abusing the protocol for not choosing to implement placeholders in their application is incorrect.
To suggest people may benefit from implementing a placeholder instead of a 404 error is useful.
My personal experience is that the error status code here is much more useful than the message. It's a big red/orange flag that says don't do what you normally do with this resource.
But if your API lends itself particularly to being queried for things that often don't exist then those red flags become noise that mask other things you really do want to flag as errors.
- miohtama 4y agoIt really doesn’t matter how the API behaves unless there are external users. When you need to convince other people to use your API then those people will bring their own expectations how the API behaves and then you need to manage those expectations. If your API is esocentric on its design choices other people might find it unexpected, curse and move to do something else.