I’m developing RESTful API service.
BTW, some clients request to add additional information when returning error.
We developed same protocol as facebook graph api.
{
"status": "failure",
"error": {
"message": "",
"type": "",
"code": 0000
}
}
Cause of our clients request, we are about to add more information like this.
{
"status": "failure",
"error": {
"message": "",
"type": "",
"code": 0000,
"more_info": {}
}
}
Is it good to add more_info?
This is an opinion question and may get killed for that. But in case it doesn’t…
Always shoot to return the minimum amount of information. Because anything you return you will then have to return forever. It’s easy to add more. It’s almost impossible to remove some as you’ll have customers depending on it.