403 - Invalid format
A validation error is an error due to invalid client requests.
All validation errors correspond with a 403 HTTP status code.
A validation error occurs when:
- Request body is ill-formed
e.g. invalid JSON - Required parameters are missing (either in body or in query string)
e.g. endpoint required a field which is (empty or) not specified in the request - Endpoint validation rules are not matched
e.g. minimum/maximum length constraint doesn't match
VALIDATION ERROR OBJECT
Property | Type | Description |
---|---|---|
property | string | Request property which originated the error |
message | string | Message to the user explaining what happened |
verbose | string | Message to the developer futher explaining what happened |
code | string enum
| Machine readable code to handle the error |
// HTTP status 403
{
"code": "RequiredField",
"message": "Cannot be empty",
"property": "slashtag"
}
// HTTP status 403
{
"property": "slashtag",
"message": "Value cannot be less than 2 characters long",
"code": "InvalidMinLength",
"input": "a",
"minLength": 2
}
// HTTP status 403
{
"property": "regType",
"message": "Value is not allowed",
"code": "OutOfRange",
"input": "cat",
"range": ["individual", "business"]
}
Following additional properties may appear in validation errors:
Property | Type | Description |
---|---|---|
input | object | Original input value for |
minLength | numerical | Minimum length allowed |
maxLength | numerical | Maximum length allowed |
length | numerical | Length to match |
range | array of objects | Set of allowed values |
pattern | string regex | Regex to test the input with |
prefix | string | Prefix that input has to match |
character | string | Character given in input |
Validation error codes
Code | Additional properties | Message | Description |
---|---|---|---|
InvalidFormat | none | Invalid format | Generic invalid format error with respect to the |
RequiredField | none | Cannot be empty | Field indicated in |
InvalidLength | input, length | Value cannot be different than | Number of characters of |
InvalidMinLength | input, minLength | Value cannot be less than | Value for field indicated in |
InvalidMaxLength | input, maxLength | Value cannot be more than | Value for field indicated in |
InvalidEmailAddress | input | Value is not a valid email address | Value for field indicated in |
OutOfRange | input, range | Value is not allowed | Value for field indicated in |
PatternMismatch | input, pattern | Invalid format | Value for field indicated in |
PrefixMismatch | input, prefix | Prefix mismatch | Prefix of value for field indicated in |
InvalidCharacter | input, character | Invalid character: ' | Value for field indicated in |
MustBeLowerCase | input | Value must be lowercase | Value for field indicated in |
MustBeUpperCase | input | Value must be uppercase | Value for field indicated in |
Updated about 3 years ago