Re: How to express no matching results in HTTP SEARH method?

On Wed, Nov 4, 2020 at 8:02 AM Julian Reschke <julian.reschke@gmx.de> wrote:

> Am 04.11.2020 um 03:40 schrieb Sawood Alam:
> > 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)?
>
> That would be my interpretation as well.
>
> > 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
>
> ...in which case, you wouldn't have to use a 204.
>
> > 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.
>
> If the request target exists, and accepts and processes the query, the
> response ought to be a 2xx, no?
>

The question remains open, "how to express a successful SEARCH response
with an unsuccessful search result when returning an entity body is
desired?" Does it warrant a new 2xx status code? I think this will be a
common situation for many people who would be willing to migrate their
GET-style searching where they could use a 404 to express it. Some
discussion and guidelines in the spec on this matter would be useful for a
more coherent adoption.


>
> Best regards, Julian
>
>
>
Best,

--
Sawood Alam

Received on Wednesday, 4 November 2020 13:25:38 UTC