
A good waiter will find out what’s wrong with your order and correct the problem with minimal fuss. Similarly, a good API error message will help developers quickly determine coding issues and what’s needed to fix them.
HTTP provides 70+ status codes that can be used, but a pragmatic approach suggests implementing at least three status codes (200, 300, 500) and augmenting these with status codes that are consistent and have actionable meaning across multiple APIs. Another best practice is to use concise error messages, with links guiding developers back to documentation.
As an API consumer, assumptions can again cause problems. While a status code of 200 suggests everything is ok, it’s not always so clear cut. For example, Facebook’s® Graph API can return a status code 200, however, the actual error message is included in the response data.
It’s important therefore to be mindful when working with APIs, making sure to carefully read documentation and responses as you learn how they work.
A good API error message will help developers quickly determine coding issues and what’s needed to fix them.
Read the Full Whitepaper