Errors

When a system or validation error occurs the server will respond with a 400 Bad Request response containing the original request and a list of all errors.

The error object will indicate which field in the request caused the error in the source.pointer property.


Example

For this example we will creating a new customer with a invalid IBAN and email address. The original request will be returned in the meta object at the top level, all errors are in the errors collection, also on the top level.

Request

POST /customers
X-Authorization: 53b9e049186e04743bcdd685ea0bafbd1ff9e0c7f
{
    "data": {
        "type": "customer",
        "attributes": {
        	"gender": "f",
        	"first_name": "Customer",
        	"last_name": "Test",
        	"iban": "NL19ABNA0940161857",
        	"bank_holder": "C Test",
        	"email": "customer.test+ecurring.com",
        	"telephone": "+31202616739",
        	"street": "Keizersgracht",
        	"house_number": "313",
        	"city": "Amsterdam",
        	"postalcode": "1016EE",
        	"country_iso2": "NL"
        }
    }
}

Response

HTTP/1.1 400 Bad Request
Content-Type: application/vnd.api+json
{
    "meta": {
        "original": {
            "data": {
                "type": "customer",
                "attributes": {
                    "gender": "f",
                    "first_name": "Customer",
                    "last_name": "Test",
                    "iban": "NL19ABNA0940161857",
                    "bank_holder": "C Test",
                    "email": "customer.test+ecurring.com",
                    "telephone": "+31202616739",
                    "street": "Keizersgracht",
                    "house_number": "313",
                    "city": "Amsterdam",
                    "postalcode": "1016EE",
                    "country_iso2": "NL"
                }
            }
        }
    },
    "errors": [
        {
            "status": "400",
            "title": "Invalid Attribute",
            "detail": "The email must be a valid email address.",
            "source": {
                "pointer": "/data/attributes/email"
            }
        },
        {
            "status": "400",
            "title": "Invalid Attribute",
            "detail": "The IBAN number is invalid.",
            "source": {
                "pointer": "/data/attributes/iban"
            }
        }
    ]
}