[OTDev] filtering resources returns empty list : 404 or 200 ?

Nina Jeliazkova jeliazkova.nina at gmail.com
Wed May 4 12:21:50 CEST 2011


Hi Martin,

On 4 May 2011 12:55, Martin Guetlein <martin.guetlein at googlemail.com> wrote:

> Hi Nina, All,
>
> Do your services return 404 for empty unfiltered lists as well?
>

This was the intention (there is a central piece of code that sets the
status to 404 if nothing is found) . If not I would consider it a bug :)

OK, an artificial example :

$ curl "http://apps.ideaconsult.net:8080/ambit2/compound?search=Nina" -i
HTTP/1.1 404 Not Found
Date: Wed, 04 May 2011 10:16:03 GMT
Set-Cookie: subjectid=; Path=/
Vary: Accept-Charset, Accept-Encoding, Accept-Language, Accept
Accept-Ranges: bytes
Server: Restlet-Framework/2.0m6
Content-Type: text/plain;charset=ISO-8859-1
Content-Length: 59

Not Found (404) - Query returns no results! Property = Nina



Perhaps the only advantage of having empty results as error code, is that
one can provide additional message in the body (preferably via the error
reporting mechanism, which is not used in the request above), while in case
of just empty response one may wonder if something went wrong, or there are
indeed no results.



> (e.g. status code for http://apps.ideaconsult.net:8080/ambit2/task if
> there
> are no tasks in the database).
>
>
I'll test locally,with smokeping continuously running there are almost
always task at the servers.



> I would like to have it consistent. Still, I do not have a strong opinion
> on
> this, but we need to agree on sth.
>
>
Yes, definitely.

Nina


> Martin
>
>
>
> On Wed, May 4, 2011 at 11:20 AM, Nina Jeliazkova
> <jeliazkova.nina at gmail.com>wrote:
>
> > Hi Pantelis, All,
> >
> >
> > "The *404* or *Not Found* error
> > message<http://en.wikipedia.org/wiki/Error_message> is
> > a HTTP <http://en.wikipedia.org/wiki/Hypertext_Transfer_Protocol>
> standard
> > response code <http://en.wikipedia.org/wiki/List_of_HTTP_status_codes>
> > indicating
> > that the client <http://en.wikipedia.org/wiki/Web_Browser> was able to
> > communicate with the server, but the server could not find what was
> > requested. 404 errors should not be confused with
> > "server<http://en.wikipedia.org/wiki/Web_server> not
> > found" or similar errors, in which a connection to the destination server
> > could not be made at all. A 404 error indicates that the requested
> resource
> > may be available again in the future."
> > http://en.wikipedia.org/wiki/HTTP_404
> > http://www.ietf.org/rfc/rfc2616.txt
> >
> > Now if the consensus is to have 200 in case of empty responses, I 'll not
> > insist of strictly following the HTTP RFC :)
> >
> > Best regards,
> > Nina
> >
> > On 4 May 2011 11:22, chung <chvng at mail.ntua.gr> wrote:
> >
> > > Hi Martin, All,
> > >
> > > I think should be 200, since the request is successful and in fact
> > > contains the response that corresponds to the request - so everything
> > > has gone as expected. The fact that it is empty does not raise a 404 in
> > > my opinion. Think of it from the client side: you have a client method
> > > like :
> > >
> > > listResources(URI uri, SearchParam param)::List<URI> throws
> > > ServiceInvocationException
> > >
> > > What do you expect from this method in case the server returns an empty
> > > list? I guess the answer is to return an *empty list* and not throw an
> > > error.
> > > Error 404 is to be thrown if the request is applied on a non-existing
> > > resource like http://server.com/asdf?search=test
> > >
> > > Best regards,
> > > Pantelis
> > >
> > > On Tue, 2011-05-03 at 14:05 +0200, Martin Guetlein wrote:
> > >
> > > > Hello All,
> > > >
> > > > when filtering a OpenTox resource list with a search param (e.g.
> > > > http://apps.ideaconsult.net:8080/ambit2/dataset?search=test),
> > > > should the status code be 404 (not found), or 200 for an empty list?
> > > (e.g.
> > > > http://apps.ideaconsult.net:8080/ambit2/dataset?search=emptylist)
> > > >
> > > > I would vote for 200 (more consistent to an un-filtered list of
> > > resources,
> > > > e.g. http://apps.ideaconsult.net:8080/ambit2/dataset).
> > > >
> > > > (On the other hand, 404 might be more intuitive, e.g.: No, there is
> no
> > > > validation for model 120732:
> > > >
> > >
> >
> http://opentox.informatik.uni-freiburg.de/validation?model=http://apps.ideaconsult.net:8080/ambit2/model/130732
> > > > )
> > > >
> > > > Both is fine for me, but we should agree on a common solution.
> > > >
> > > > Regards,
> > > > Martin
> > > > <http://opentox.informatik.uni-freiburg.de/validation?model=ambit>
> > > >
> > >
> > >
> > > _______________________________________________
> > > Development mailing list
> > > Development at opentox.org
> > > http://www.opentox.org/mailman/listinfo/development
> > >
> > _______________________________________________
> > Development mailing list
> > Development at opentox.org
> > http://www.opentox.org/mailman/listinfo/development
> >
>
>
>
> --
> Dipl-Inf. Martin Gütlein
> Phone:
> +49 (0)761 203 8442 (office)
> +49 (0)177 623 9499 (mobile)
> Email:
> guetlein at informatik.uni-freiburg.de
> _______________________________________________
> Development mailing list
> Development at opentox.org
> http://www.opentox.org/mailman/listinfo/development
>



More information about the Development mailing list