Validierungsfehler
Request-Validierung in ihren gängigen Formen. /register: handgeschriebene Regeln, 422 application/problem+json (RFC 7807) mit Fehlern pro Feld. /strict: lehnt unbekannte Felder (400) und ungültige (422) ab. /annotations: DataAnnotations-Modell; [ApiController] erzeugt das automatische 400 des Frameworks. /problem/{type}: Beispiel-Problem-Dokumente für jeden gängigen Fehlerstatus. Nichts wird gespeichert, derselbe Payload bekommt also immer dieselbe Antwort.
- POST
https://api.testingapis.com/api/validation/annotationsValidate a DataAnnotations model using the framework's automatic 400. - GET
https://api.testingapis.com/api/validation/problemList the sample problem document types. - GET
https://api.testingapis.com/api/validation/problem/{type}Get a sample RFC 7807 problem document. - POST
https://api.testingapis.com/api/validation/registerRegister a user; invalid fields return 422 problem+json. - POST
https://api.testingapis.com/api/validation/strictAccept only known fields; unknown fields return 400.
Beispiel-Request
List the sample problem document types. Vollständige Referenz und Send-Button (auf Englisch).
cURL
curl -X GET "https://api.testingapis.com/api/validation/problem"Antwort · 200 OK
[
{"type": "bad-request", "status": 400, "url": "/api/validation/problem/bad-request"},
{"type": "unauthorized", "status": 401, "url": "/api/validation/problem/unauthorized"},
"… 8 more items"
]