Timeline for When to use HTTP status code 404 in an API
Current License: CC BY-SA 3.0
11 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Apr 12, 2017 at 7:31 | history | edited | CommunityBot |
replaced http://programmers.stackexchange.com/ with https://softwareengineering.stackexchange.com/
|
|
Jul 3, 2013 at 14:49 | comment | added | user69037 | @AndresF. To be honest, a 500 code is probably fine. Given how the question has changed over time, it'd work. Mostly, I'm just rallying against returning 200 if everything isn't OK. | |
Jul 3, 2013 at 11:59 | comment | added | Andres F. | @LegoStormtroopr If we're going to pay attention to the wording in the official HTTP spec: "The 4xx class of status code is intended for cases in which the client seems to have erred". In this case, the client has NOT erred: it asked for a resource that must be there for the system to function as specified. | |
Jul 3, 2013 at 11:52 | comment | added | Andres F. | @LegoStormtroopr In this case, the server is aware it has erred: it was asked a mandatory resource (mandatory in the sense the system doesn't work without it, as per the requirements) but it's missing. A precondition has been broken: at least the state of the system is undefined, but I think a 5xx error is warranted. | |
Jul 3, 2013 at 1:45 | comment | added | user69037 | @Sybiam If you are going to go the route of a 5xx code, 503 is "503 Service Unavailable - The server is currently unable to handle the request due to a temporary overloading or maintenance of the server." Your server isn't overloaded, its not finding a request. Additionally, 5xx codes are for when "the server is aware that it has erred or is incapable of performing the request" | |
Jul 3, 2013 at 1:24 | comment | added | Loïc Faure-Lacroix | @AndresF. I have to say that I'm pretty much falling on your side. Since the state of the system is invalid, it makes a lot more sense. The 500 might be brutal but the 503 sounds more elegant since the service might get fixed in the future. It sounds weird to go back to 5xx when we try to get rid of them as much as possible. But that's the only answer that makes lot of sense | |
Jul 3, 2013 at 0:57 | comment | added | imel96 | @LegoStormtroopr it's asking for /GoalTree/Get* resources (which exists) entities that match some queries. The resources exist, the entities as result of the queries may or may not be exist. | |
Jul 3, 2013 at 0:53 | comment | added | Andres F. | @LegoStormtroopr Besides, the tree must exist; the system cannot function without it, as per the OP's explanation. Therefore, it's valid to ask for this resource; if it's not there, it must be a system (or server) error. | |
Jul 3, 2013 at 0:51 | comment | added | Andres F. | @LegoStormtroopr Asking for something that doesn't exist isn't always an error. If you ask for a network resource, and the network is down, then it's a network error. | |
Jul 3, 2013 at 0:49 | comment | added | user69037 | Not true, the user is in error because they asked for something that does not exist. | |
Jul 3, 2013 at 0:44 | history | answered | Andres F. | CC BY-SA 3.0 |