Tellore@lemmy.worldtoProgramming@programming.dev•What is your preferred API error response and why?English
11·
2 months agoWhen consuming APIs you often want JSON in successful scenario. Which means, if you also have JSON in unsuccessful scenario it’s a bit more uniform, because you don’t have to deal with JSON in one case and plaintext response in other. Also, it sometimes can be useful to have additional details there like server’s stacktrace or some identifiers that help troubleshoot complex issues.
It’s ok for internal admin panels and their backends as there are no security concerns in this case.