Thomas Hunter II is author of this guide on hot topic how to avoid common API mistakes. The advice in this article applies to any API. However, some of the issues author considers are easier to encounter when the application is written in a dynamic language, such as JavaScript, versus a more static language, such as Java.
Be sure to follow the Robustness Principle wherever it may apply to your API. Quoting from Wikipedia, this principle is:
Be conservative in what you do, be liberal in what you accept from others.
The good practice mentioned in this article includes:
- Be stingy with data
- Represent upstream data as well-defined objects
- Use forward compatible attribute naming
- Normalize concepts and attributes
- Use positive, “happy” names
- Apply the Robustness Principle (e.g. in regard to HTTP headers)
- Test all error conditions
Read the rest of the article to learn what advice to follow so you can be sure to avoid some of the most common pitfalls present in modern APIs. Nice one!
[Read More]