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

Martin Guetlein martin.guetlein at googlemail.com
Wed May 4 11:55:07 CEST 2011


Hi Nina, All,

Do your services return 404 for empty unfiltered lists as well?
(e.g. status code for http://apps.ideaconsult.net:8080/ambit2/task if there
are no tasks in the database).

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

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



More information about the Development mailing list