If the response from the API came with code = VALIDATION_FAILURE, then params will contain validation rules that did not pass the input data.
Response format:
{
"status": "error",
"response": {
"code": 1,
"name: "VALIDATION_FAILURE",
"message": "Validation failure",
"params": {
"<param>": {
"<rule>": [
"<value 1>",
"<value 2>",
"<value n>"
],
...
},
...
}
}
}
where:
| Validation rule | Rule Options | Rule Description |
|---|---|---|
| Required | - | Required parameter |
| Sometimes | - | Optional parameter |
| Filled | - | The value must be filled. Used in conjunction with Sometimes |
| Numeric | - | The value must be numeric, including floating point. Decimal separator - dot |
| Integer | - | The value must be an integer. Used in conjunction with Numeric |
| - | Value must be an email address | |
| Url | - | The value must be a URL |
| Min |
|
Minimum value |
| Max |
|
Maximum value |
| Unique |
|
The passed value must be unique (not present in the table) |
| In |
|
The passed value must be in the list of valid values |
| Exists |
|
The transferred value must be present in the table, in the specified field |
| Array | - | Value must be an array |