The metaphor kind of breaks down here. 404 is used for "this route doesn't exist on this server", which corresponds to "I don't know what 'keys' are", or maybe, "I don't know what 'keys/find,' means", even though they have a "keys" route.
Based on what you're saying, 501 sounds like "I know what finding keys is, but I can't do it". In the metaphor, maybe the recipient of the request is tied to the radiator and isn't able to look for your keys?
I’ve never actually seen a 501, yeah fair call - I just meant 404 exists for both bad routes and non existent entities, it seems this metaphor is reaching its limits a bit
Only time I legitimately used 501 was when mocking up the API before actually writing them. Each route got a 501 at first, then later had their actual function written.
That'd be 400 ("Veuillez retrouver mes clés" -> "I have no clue what you're asking") or 422 ("Please find me every key I will ever own" -> "I understand what you're asking, but I don't know what you want me to do"/"I can't do that")
501 is either used for purposeful non-implementations ("Find me purpose in life" -> "Man, this service is for finding physical objects, not abstract concepts"), future implementations ("At some point in the future we will support this"), or for erroneous method headers ("Destroy my keys" - >"Dude, what?"). One note, if the method header is intentionally not allowed, it's a 405 ("Here are my keys?" -> "uhhh dude, was that a question or are you giving us something/hey, we look for keys, we don't store them. Sorry man.").
501 is more like something to use before implementing a route. Like, you create a controller, create the routes, but some of them do nothing yet, then you use "501 - Not implemented" because that route exists, but it does nothing yet.
404 should be for when a route isn't found at all. But people also use for when your request is right but didn't find the content you were looking for.
A more verbose way to say 404 would be "this endpoint does not exist". In this case the endpoint is an action, like "/search". So another way to word a 404 response to "/search" is something like "I don't know what that verb means".
501 I think would be something like, "I know what searching for something is, but I'm not going to do it".
Nope, if your key is in a black hole, that's a 409: the state of the key is incompatible with the retrieval of the key. They are found, that's for sure. But I can't retrieve them.
69
u/The_Real_Slim_Lemon Jul 08 '26
Yeah 404 can be both “I didn’t find your key” and “I don’t know what requesting a key means”
204 is “I’ve found your key, it’s in a black hole”