--- id: status-and-error-codes sidebar_position: 1 title: Fehlerverhalten und Statuscodes --- > Wo 200 Licht ist, ist auch 403 Schatten. -Göthe Diese Seite gibt einen Überblick über Fehlerhandling in der FIT-Connect Submission API (nachfolgend nur noch *API* genannt). ## Features * Liefert zu allen Fehlerantworten einen HTTP Statuscode laut [RFC 7231 (Hypertext Transfer Protocol (HTTP/1.1): Semantics and Content)](https://datatracker.ietf.org/doc/html/rfc7231#section-6) zurück. * Liefert Fehler (4xx und 5xx HTTP Statuscodes) im JSON Format nach [RFC 7807 (Problem Details for HTTP APIs)](https://datatracker.ietf.org/doc/html/rfc7807) aus. * Fehler besitzen **immer** folgende Felder: * `type`: Eine URI (möglicherweise als Website aufrufbar) die den Typ des Fehlers eindeutig klassifiziert. Beispiel: `https://schema.fitko.de/fit-connect/submission-api/problems/submission-not-found` * `title`: Ein kurzer und menschenlesbarer Titel des Fehlers. Beispiel: `Application not found` * `status`: Eine Kopie des HTTP Statuscodes * Fehler können **optional** weitere Felder beinhalten. API Clients **müssen** hiermit umgehen können. * Unterscheidet zwischen technischen und fachlichen Fehlern ## Liste von Fehlercodes Wir versuchen bei Fehlern stets sinnvolle Fehlermeldungen bereitzustellen um eine Fehleranalyse zu vereinfachen. Wir sind aber auch Menschen und daher nicht perfekt. Falls euch ein Fehler oder eine Inkonsistenz auffällt, [erstellt bitte ein Issue](https://git.fitko.de/fit-connect/api/-/issues/new). Wir unterscheiden zwischen technischen und fachlichen Fehlern. Technische Fehler sind nicht explizit in der API-Spec abgebildet. Fachliche schon. ### Technische Fehler | `type` des technischen Fehlers | Titel laut [httpstatus.es](https://httpstatuses.com/) | Beschreibung | |------------------------------------------------------------------------|---------------------------------------------------------|--------------| | https://schema.fitko.de/fit-connect/submission-api/problems/constraint-violation | 400 Bad Request | | | https://schema.fitko.de/fit-connect/submission-api/problems/request-binding-error | 400 Bad Request | | | https://schema.fitko.de/fit-connect/submission-api/problems/no-handler-found | 404 Not Found | | | https://schema.fitko.de/fit-connect/submission-api/problems/missing-request-part | 400 Bad Request | | | https://schema.fitko.de/fit-connect/submission-api/problems/missing-request-parameter | 400 Bad Request | | | https://schema.fitko.de/fit-connect/submission-api/problems/socket-timeout | 504 Gateway Timeout | | | https://schema.fitko.de/fit-connect/submission-api/problems/type-mismatch | 400 Bad Request | | | https://schema.fitko.de/fit-connect/submission-api/problems/multipart-error | 400 Bad Request | | | https://schema.fitko.de/fit-connect/submission-api/problems/message-not-readable | 400 Bad Request | | | https://schema.fitko.de/fit-connect/submission-api/problems/method-not-supported | 405 Method Not Allowed | | | https://schema.fitko.de/fit-connect/submission-api/problems/media-type-not-supported | 415 Unsupported Media Type | | | https://schema.fitko.de/fit-connect/submission-api/problems/media-type-not-acceptable | 406 Not Acceptable | | | https://schema.fitko.de/fit-connect/submission-api/problems/unsupported-operation | 501 Not Implemented | | | https://schema.fitko.de/fit-connect/submission-api/problems/invalid-state-transition | 500 Internal Server Error | | ### Fachliche Fehler | `type` des fachlichen Fehlers | Titel laut [httpstatus.es](https://httpstatuses.com/) | Beschreibung | |---------------------------------------------------------------------------|---------------------------------------------------------|--------------| | https://schema.fitko.de/fit-connect/submission-api/problems/access-forbidden | 403 Forbidden | | | https://schema.fitko.de/fit-connect/submission-api/problems/submission-already-fetched | 410 Gone | | | https://schema.fitko.de/fit-connect/submission-api/problems/submission-incomplete | 422 Unprocessable Entity | | | https://schema.fitko.de/fit-connect/submission-api/problems/submission-not-found | 404 Not Found | | | https://schema.fitko.de/fit-connect/submission-api/problems/not-in-acknowledgeable-state | 422 Unprocessable Entity | | | https://schema.fitko.de/fit-connect/submission-api/problems/attachment-not-announced | 422 Unprocessable Entity | | | https://schema.fitko.de/fit-connect/submission-api/problems/attachment-not-found | 404 Not Found | | | https://schema.fitko.de/fit-connect/submission-api/problems/destination-not-found | 404 Not Found | | | https://schema.fitko.de/fit-connect/submission-api/problems/destination-state-invalid | 422 Unprocessable Entity | Der Zustellpunkt existiert, hat aber einen für die Aktion unzulässigen Status. | | https://schema.fitko.de/fit-connect/submission-api/problems/empty-attachment | 400 Bad Request | | | https://schema.fitko.de/fit-connect/submission-api/problems/jwk-not-valid | 422 Unprocessable Entity | JWK fachlich nicht zulässig. Details stehen im Feld `detail`. | ## Verhalten von API Clients API-Clients sollten gemäß RFC 7231 so implementiert sein, dass auch unbekannte HTTP Statuscodes gemäß ihrer Statusklasse (`Axx, A=[1,5]`) interpretiert werden können: > "HTTP status codes are extensible. HTTP clients are not required to understand the meaning of > all registered status codes, though such understanding is obviously desirable. However, a client > MUST understand the class of any status code, as indicated by the first digit, and treat an > unrecognized status code as being equivalent to the x00 status code of that class, with the > exception that a recipient MUST NOT cache a response with an unrecognized status code."