Skip to main content
Skip table of contents

Validation

Validation

The error object always follows a specific format.

CODE
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 may be exceptions where the error does not relate to a specific field.
There can be multiple errors.

Example:
The request includes a field called url with a value of http//example.com.
This field has a validation that it should be a URL with a maximum of 10 characters.

There is also a field called date with a value of 2000-01-01 and a validation that the date format should be Y-m-dTH:i:sp.

The response will contain the following object:

{
    "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 match the format Y-m-dTH:i:sp."
        ]
    }
}
cURL
BASH
curl -k --request POST \
	--url 'https://your-domain' \
	--header 'Content-Type: application/json' \
	--header 'Accept: application/json' \
	--data '[]'
PHP
PHP
$data = array (
);
$context = stream_context_create([
	'ssl'=>['verify_peer' => false],
	'http' => [
		'method' => '/',
		'header' => "Content-Type: application/json\r
Accept: application/json",
		'content'=>json_encode($data)
	]
]);
$result = file_get_contents('https://your-domain', false, $context);
JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.