Error Responses
When we submit an invalid request to the breathe API, we get a standardised error response in the form of a JSON object:
$ curl https://api.breathehr.com/v1/employees -H 'X-API-KEY: prod-1OcTwKW8ln5ARz04IjsrJEQTZgP3Ir1sWfyuOLdqC1Y’ \ -d employee[first_name]=foo
{ "error": { "type":"Record Invalid", "employee[last_name]": [ "missing" ], "employee[email]": [ "missing" ] } }
In this case, since we were trying to create an employee object but we did not submit all the required fields, we get an error object which mirrors the structure of an actual employee object to some extent, except that each field points to an array of error messages. There is also a type field describing the type of error. The HTTP error code will be 400.