Consider a situation when there is a jersey-client which returns 404 if some requested url is not found (i.e. the endpoint does not exist, there is a typo in a requested address etc.). But, at the same time, the resource itself using the same status to indicate that the requested endpoint is exist but the data we're looking for is not found.
Is there a good way (from design point of view) to distinguish between these two states in order to be sure what actually happened?
I usually use Content-Type
header to distinguish if 404 is because entity does not exist or url from request is not found. In first case the Content-Type
is the same as for valid response i.e application/json
, in second it's text/html
.