-
Notifications
You must be signed in to change notification settings - Fork 2
Description
API server NSM vrací některé špatné stavové kódy v HTTP odpovědích.
Definice očekávaných návratových kódů:
200 OK -- The HTTP 200 OK success status response code indicates that the request has succeeded.
400 Bad Request -- The HyperText Transfer Protocol (HTTP) 400 Bad Request response status code indicates that the server cannot or will not process the request due to something that is perceived to be a client error (for example, malformed request syntax, invalid request message framing, or deceptive request routing).
401 Unauthorized -- The HyperText Transfer Protocol (HTTP) 401 Unauthorized response status code indicates that the client request has not been completed because it lacks valid authentication credentials for the requested resource.
403 Forbidden -- The HTTP 403 Forbidden response status code indicates that the server understands the request but refuses to authorize it. This status is similar to 401, but for the 403 Forbidden status code, re-authenticating makes no difference. The access is tied to the application logic, such as insufficient rights to a resource.
404 Not Found -- The HTTP 404 Not Found response status code indicates that the server cannot find the requested resource.
405 Method Not Allowed -- The HyperText Transfer Protocol (HTTP) 405 Method Not Allowed response status code indicates that the server knows the request method, but the target resource doesn't support this method.
406 Not Acceptable -- The HyperText Transfer Protocol (HTTP) 406 Not Acceptable client error response code indicates that the server cannot produce a response matching the list of acceptable values defined in the request's proactive content negotiation headers, and that the server is unwilling to supply a default representation.
501 Not Implemented -- The request method is not supported by the server and cannot be handled. The only methods that servers are required to support (and therefore that must not return this code) are GET and HEAD.
Pokud tedy endpoint neexistuje, server vrací 404 Not Found.
Pokud endpoint existuje, ale je použita metoda, kterou server zná, ale není implementovaná, vrací 405; pro neznámou metodu se vrací 501.
Pokud se jedná o zdroj (endpoint) s omezeným přístupem, vrací se 401 pokud nelze uživatele autorizovat nebo je autorizační prostředek neplatný. V případě, že je možné přístup autorizovat, ale uživatel nemá např. dostatečná práva vrací se 403.
Kód 400 se vrací v ostatních případech špatného requestu (např. nedodržená syntaxe).