TestingAPIs is still being built. If something breaks, email support@testingapis.com.

Validate a DataAnnotations model using the framework's automatic 400

POSThttps://api.testingapis.com/api/validation/annotationsSign in to see this endpoint's URL

Invalid models are rejected by [ApiController] before the action runs, with a standard ValidationProblemDetails body.

Request body

Optional. application/json, text/json, application/*+json, application/xml, text/xml, application/*+xml. Model: ValidationControllerAnnotatedSignup. The signup to validate.

Example body
{
  "username": "ava_t",
  "email": "ava@example.com",
  "age": 29,
  "countryCode": "US",
  "website": "https://ava.dev",
  "phone": "+1 555 0101",
  "tags": ["qa", "api"]
}

Responses

200
OK
201
Model is valid.
400
Validation errors (ValidationProblemDetails).

Example

Request
curl -X POST "https://api.testingapis.com/api/validation/annotations" \
  -H "Content-Type: application/json" \
  -d '{"username": "ava_t", "email": "ava@example.com", "age": 29, "countryCode": "US", "website": "https://ava.dev", "phone": "+1 555 0101", "tags": ["qa", "api"]}' \
  -H "X-TestingApis-Key: YOUR_API_KEY"
Response201 Created
{
  "message": "Signup is valid",
  "data": {
    "username": "ava_t",
    "email": "ava@example.com",
    "age": 29,
    "countryCode": "US",
    "website": "https://ava.dev",
    "phone": "+1 555 0101",
    "tags": ["qa", "api"]
  }
}

Sign in to see the details

The parameters, request and response examples and the live Try it panel for this endpoint are for signed-in members. Accounts are free and take a few seconds to create.