検証エラー
よくある形式のリクエスト検証。/register:手書きのルールで、フィールドごとのエラーを含む 422 application/problem+json(RFC 7807)。/strict:無効なフィールド(422)に加え、未知のフィールドも拒否(400)。/annotations:DataAnnotations のモデルで、[ApiController] がフレームワークの自動 400 を返します。/problem/{type}:よくあるエラーステータスごとのサンプル problem ドキュメント。何も保存しないので、同じペイロードには常に同じ答えが返ります。
あなたのアカウントでこれらのエンドポイントが使えます。各エンドポイントのページの Try it でリクエストを送れます。
- POST
https://api.testingapis.com/api/validation/annotationsValidate a DataAnnotations model using the framework's automatic 400Validate a DataAnnotations model using the framework's automatic 400. - GET
https://api.testingapis.com/api/validation/problemList the sample problem document typesList the sample problem document types. - GET
https://api.testingapis.com/api/validation/problem/{type}Get a sample RFC 7807 problem documentGet a sample RFC 7807 problem document. - POST
https://api.testingapis.com/api/validation/registerRegister a userRegister a user; invalid fields return 422 problem+json. - POST
https://api.testingapis.com/api/validation/strictAccept only known fieldsAccept only known fields; unknown fields return 400.
リクエストの例
List the sample problem document types. 完全なリファレンスと Send ボタン(英語).
cURL
curl -X GET "https://api.testingapis.com/api/validation/problem"レスポンス · 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"
]サインインして詳細を見る
これらのエンドポイントのパラメータ、リクエストとレスポンスの例、ライブの Try it パネルは、サインインしたメンバー向けです。アカウントは無料で、数秒で作成できます。