Closed Vallenain closed 7 years ago
and a good way to resolve this is in the answers of this question: http://stackoverflow.com/questions/28444556/laravel-5-general-error-as-json
fixed, the chosen format is:
{ "error": { "status" : <number>, "message" : <string> } }
where the status is a HTTP status code.
It can be returned by writing anywhere abort(status, message);
in the PHP code.
The calls to
/api/0.1/
return HTML document in case of error (I think it's the default behaviour of Laravel). But for APIs, those responses should be programmatically read and so we'd need a standard JSON error object. Probably something like