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

Accept only known fields

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

Accept only known fields; unknown fields return 400.

Field names are case-sensitive. Unknown fields are checked before values are validated.

Request body

Optional. application/json, text/json, application/*+json, application/xml, text/xml, application/*+xml. JSON object with exactly: name (1-50 characters), email and quantity (integer 1-99).

Example body
{"name": "Widget", "email": "a@b.co", "quantity": 2}

Responses

200
Payload accepted.
400
Unknown fields (problem+json with unknownFields), or the body is not an object.
422
Invalid values.

Example

Request
curl -X POST "https://api.testingapis.com/api/validation/strict" \
  -H "Content-Type: application/json" \
  -d '{"name": "Widget", "email": "a@b.co", "quantity": 2}' \
  -H "X-TestingApis-Key: YOUR_API_KEY"
Response200 OK
{"message": "Payload accepted", "data": {"name": "Widget", "email": "a@b.co", "quantity": 2}}

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.