How to express no matching results in HTTP SEARH method?

Hi,

What would be an appropriate status code if the target resource of the
SEARCH method wants to provide an entity to convey that the search
operation yielded no results? In traditional GET-style searching, one could
return a 404, would that still be an option (I doubt it as it would mean
the target resource itself that performs the search is not found)?

The specification seems to suggest usage of 204, but in that case no
content can be returned in the response, which may be desired in some
cases. Also, 204 is a success response, which means a client might repeat
the request, while a 4xx response would suggest that there is no point in
repeating the request without making changes to it.

Best,

--
Sawood Alam

Received on Wednesday, 4 November 2020 02:40:59 UTC