Validation. VMS Client API
An error object always has a consistent format.
The error data is contained within the 'errors' object.
The keys within the 'errors' object indicate which field in the request the errors belong to.
However, there can be exceptions where the error is not specific to a particular field.
There can be multiple errors.
Example:
In the request, the 'url' field is provided with the value 'http//example.com'.
This field has a validation that it should be a URL and not exceed 10 characters.
Similarly, the 'date' field is provided with the value '2000-01-01', and there is a validation that the date format should be 'Y-m-dTH:i:sp'.
In the response, the following object will be returned:
{
"message": "The given data was invalid",
"errors": {
"url" : [
"The url field has an invalid format.",
"The url field cannot exceed 20 characters"
],
"date": [
"The date field does not follow the Y-m-dTH:i:sp format."
]
}
}