I am creating a web service that is used in this particular case to request information about a patron.
Say, for the sake of argument, that an Internet search hit:
GET /patrons/619 HTTP/1.1
If a cartridge is found, I return code 200:
HTTP/1.1 200 OK
If you omit or specify an account number that is not a number, I return 400. For example, the following bad queries:
GET /patrons HTTP/1.1 GET /patrons/ HTTP/1.1 GET /patrons/G619 HTTP/1.1 GET /patrons/kirsten%20guyer HTTP/1.1
all 400 return error (invalid request), for example:
HTTP/1.1 400 Invalid patron number
I want the status code not found protector returned as HTTP status code. For example:
GET /patrons/1322 HTTP/1.1 HTTP/1.1 404 Not Found
I thought about using 404 (not found) , which is a valid answer (the requested resource was, indeed, in truth, not found.) But I'm afraid that people are debugging it, think that it means that they write /patrons/ .
Can anyone think of another http status code that I could use?
Update: I am watching
204 No Content The server successfully processed the request, but is not returning any content.
What are you saying?
Keep in mind that not all HTTP servers serve HTML content. If a resource is proposed on the IIS web server with the name:
GET /MyStartPage.html HTTP/1.1
Then the HTTP server should decide what to respond. On most web servers, a resource named /MyStartPage.html corresponds to a file located on the hard drive.
While StackOverflow does:
GET /posts/1027301 HTTP/1.1
What if this resource does not exist, the web server should (correctly) return 404.