From: Robert F. <xro...@go...> - 2006-06-01 21:44:16
|
my intuition would certainly speak against 404 "no items found". in fact, i added the handler for 404 responses to valid query requests after running into the problem. 0 matching results does not feel qualitatively different to 10 matching results. and i think it's the query context - thus something client side - which decides whether 0 results means there's something wrong. i also think http responses in the 4xx range indicate exactly this: something's wrong. probably worth a different post: i think there should be a way to post citation data. i.e. the body of a request adding/updating a post should not be url parameters, but an xml document like the one returned for querying posts. robert On 6/1/06, Lund, Ben <b....@na...> wrote: > Hi Robert, > > On 25/5/06 21:12, "Robert Forkel" <xro...@go...> wrote: > > hi, > > while testing my api wrapper, i ran into a problem with the webapi: > > queries for tags/posts/bookmarks return 404 if no matches have been > > found. to cater for this, the wrapper tried to parse a webapi response > > for this http status code. for some requests - e.g. for non-existing > > users like http://www.connotea.org/data/bookmarks/user/http > > - only the apache default 404 page is returned, which can't be parsed > > as webapi response. > > Hmm, thanks. That's definitely a bug. A response XML document should > definitely be returned, whatever the appropriate status code. It looks like > it only happens when there's a user in the request (see, for example, > http://www.connotea.org/data/tag/gfdgffdgfdgfdfgd for what it should look > like). > > We'll fix that. > > > so i'd propose to return 200 with a webapi > > response saying "no items found" for empty searches, or simply empty > > result xml? > > what do you think? > > Looking through the HTTP spec, the following codes are likely candidates: > > 200 OK - with an empty XML document > 204 No content - with no body at all > 400 Bad request - indicates that the tag or username in invalid > 404 Not found - indicates that the tag or user is unknown > > Looking through these, 400 seems too harsh -- the request was valid syntax, > just resulting in no items. 204 looks good, but we wouldn't be to put a > Response body, nor explain exactly why there is no content. > > I'm not sure about 200. If we included an empty XML doc as the response we > again wouldn't be able to give details on why there were no results. If we > included a response doc instead, that complicates the parsing a little, > since the client needs to check the status code and also the root XML > element before knowing what to do next. > > So I'm leaning towards sticking with 404 - given that either that tag or the > user were not found, I think it matches the intended meaning well. > > But I'm willing to be convinced -- what do you think? > > > robert > > Ta, > Ben > > > ******************************************************************************** > DISCLAIMER: This e-mail is confidential and should not be used by anyone who is > not the original intended recipient. If you have received this e-mail in error > please inform the sender and delete it from your mailbox or any other storage > mechanism. Neither Macmillan Publishers Limited nor any of its agents accept > liability for any statements made which are clearly the sender's own and not > expressly made on behalf of Macmillan Publishers Limited or one of its agents. > Please note that neither Macmillan Publishers Limited nor any of its agents > accept any responsibility for viruses that may be contained in this e-mail or > its attachments and it is your responsibility to scan the e-mail and > attachments (if any). No contracts may be concluded on behalf of Macmillan > Publishers Limited or its agents by means of e-mail communication. Macmillan > Publishers Limited Registered in England and Wales with registered number 785998 > Registered Office Brunel Road, Houndmills, Basingstoke RG21 6XS > ******************************************************************************** > |