Validation. VMS Billing API
An object with an error always has the same format.
The error data is contained within the errors object.
The keys inside errors tell which field from the request the errors refer to.
But there may be exceptions when the error does not apply to a specific field.
There may be several errors.
Example
The url field with the value http//example.com is passed in the request.
This field is validated that it must be a url address and be no more than 10 characters
And also the date field with the value 2000-01-01, and the validation that the date format should be Y-m-d H:i:s
Then the response will be the following object:
{
"message": "The given data was invalid",
"errors": {
"url" : [
"The url field is in the wrong format.",
"The url field cannot be more than 20"
],
"date": [
"The date field does not match the format Y-m-d H:i:s."
]
}
}