Error Response
An endpoint will return message
and/or errors
fields, if there is any error. message
field is the error message that typically will be displayed on the Toast Bar. errors
field is an object to represent field that is invalid. This is the example of message errors
fields:
{
"message": "Error Message",
"errors": {
"field1": ["Field 1 error message"],
"field2": ["Field 2 error message"],
"field3": [{...}]
}
}
All the response codes we use are defined by RFC9110. Except for the resource creation, we use 200 code instead of 201.
400 - 499: Bad Request
{
"message": "Error Message",
"errors": {
"field1": ["Field 1 error message"],
"field2": ["Field 2 error message"],
"field3": [{...}]
}
}
500 - 599: Internal Server Error
The response have no body.