Say the client is requesting the following URL:
/user-details?user=123
If /user-details was a non-existing resource, the correct status code would obviously be 404.
However if /user-details does exist, but no user with id 123 exists:
- I've so far returned a
404 Not Found, but experience has told me that it makes it confusing to not know whether it is the resource, or the entity that was not found; - I've considered using
400 Bad Request, but I find it confusing as well, as the request is technically correct, just requesting a non-existing entity.
Is there a more suitable HTTP status code for this purpose?
404is better, I'm just not ready to accept it yet, I believe ;)