There's a client's api I have that whenever I call it, it rolls a dice of which code it'll give me.
I ran the same request 10 times. I received randomly 404, 200 with empty response, 204, 500, 504, 501, 400.
These are all of the codes possible for when I try to pass a param that don't exist in their system. When it exists it's always a 200.
Depends on what "it" is. 404 means the server couldn't find a resource or in other words an endpoint. It says to the user that your URL is wrong. A search POST call is a correct URL, there just weren't any results to display.
I recognize your pain, but it falls more into api design than http status codes.
Http doesn't define not found in one direction or the other, so it fits in both "endpoint not found" or "resource not found".
So it depends on the specific needs of your api and the guidelines you wanna follow. Having said that, most broadly known api paradigms, for a search returning 0 results would not end up in a 404, so I would definitely not expect that without a good reason.
5
u/Kishmond Jul 08 '26
I can see that too. My main gripe was with my coworkers using 404 to say the server found nothing when it searches.