Validation

All resources that accept data as form-data have server-side validation enabled.

When validation for a resource fails a 422 status code will be returned. The response body of the request will not contain the data key but a message and errors key instead.

Key Type(s) Description
message int Simple message noting that the validation failed
errors array Array containing the validation errors

Example

If we do not supply any of the required parameters for a login request the response will look like this;

{
    "message": "The given data was invalid.",
    "errors": {
        "username": [
            "gebruikersnaam is verplicht."
        ],
        "password": [
            "wachtwoord is verplicht."
        ]
    }
}

The errors key will always be an array even if there is only one parameter that fails validation. It contains a key => array pair with translated strings explaining the validation failure(s).