What status code should be returned if one of these pages was called without required parameters? (and therefore cannot return any content).
You can choose 404 Not Found :
The server did not find anything that matched the Request-URI [if your required parameters are part of the URI, i.e. $_GET ] . It is not indicated whether this condition is temporary or permanent. The status code 410 (Gone) MUST be used if the server, through some mechanism that can be internally configured, knows that the old resource is constantly unavailable and does not have a forwarding address. This status code is usually used when the server does not want to determine exactly why the request was rejected, or when another response is not applicable.
(highlight me)
404 Not Found is a subset of 400 Bad Request that could also be accepted because it is very clear what it is:
The request could not be understood by the server due to incorrect syntax. The client SHOULD NOT repeat the request unchanged.
I canโt actually assume that you are choosing a WEBDAV response code that does not exist for HTTP clients using hypertext, but you could, itโs absolutely true that you are a server encoder, you can actually accept any HTTP response status code you consider necessary for your HTTP client, which you are also a developer:
11.2. 422 Non-process organization
Status code 422 (raw entity) means the server understands the content type of the request object (therefore, 415 (Unsupported media type) is not suitable), and the syntax of the request object is correct (thus, 400 (failed request) status code is not suitable), but not was able to process the contained instructions. For example, this error condition may occur if the XML body of the request contains well-formed (that is, syntactically correct) but semantically erroneous XML instructions.
An IIRC request entity is a request entity. Therefore, if you work with the request authorities, this may be appropriate, as Julian wrote.
You commented:
IMHO, the text for 400 indicates incorrect syntax. I would suggest that the syntax here refers to the syntax of the HTTP string that the client sends to the server.
It can be, but it can be something syntactically expressed, the entire request, only some request headers or a specific request header, request URI, etc. 400. Not specifically about the "HTTP string syntax", it is a general response to a client error:
The 4xx class code class is designed for cases where the client seems to be wrong. Except when responding to a HEAD request, the server SHOULD include an object containing an explanation of the error situation, and whether this is a temporary or permanent condition. These status codes apply to any request method. User agents MUST display any item on the list.
The important role here is that you must tell the client what went wrong. The status code simply says that something went wrong (in class 4xx), but HTTP was not specifically designed to eliminate the missing parameter of the request details and information as an error condition. In fact, the URI only knows that there is a part of the request-information, and not what it means.
If you think 400 is too wide, I suggest you choose 404 if the problem is with a URI, for example. $_GET .