[cgiapp] Best practice for CGI errors
Mark Knoop
mark at rawcane.net
Mon Sep 22 10:13:15 EDT 2008
Hi
I suspect the reason I can't fun the answer for this is that it is too
obvious... but I am having a moment of doubt!
If one wants to return an error to the client because they have not included
the correct parameters for the CGI request, should one use one of the HTTP
status codes and if so which one? And then is it ok/sensible to include an
error message in the body?
Or should success or failure at the app level be indicated solely in the
body of the response, with the HTTP response codes only being used to
indicate an HTTP error ie if they don't include the correct parameters for
one's app but it is still a valid HTTP request then use 200 but have some
error notification inside the response body. If this is the case is there
any kind of standard practice?
I should probably mention that I am not responding with HTML here but rather
this is a simple API or 'web service' - however I was hoping to avoid using
SOAP or the like as it is very simple and CGI style GET with the return
value in the response body should work fine - just having a momentary
quandary on the error issue.
Any suggestions gratefully receieved!
Cheers
Mark
More information about the cgiapp
mailing list