DPC2019: The making of a great API - Rob Allen

Explore the design principles and best practices for building a great API, covering topics such as documentation, implementation, versioning, authentication, error handling, and more.

Key takeaways
  • Write tutorials, reference documentation is vital, and users should be able to use the API without reading the code.
  • API documentation should be human-readable and provide links to error responses.
  • Decouple API design from implementation, and use an open API specification.
  • Use standards, such as those from the HTTP/1.1 specification, for things like rate limiting and authentication.
  • Structure API endpoints to be malleable, allowing for flexibility in the future.
  • Ensure correctness, error handling, and documentation are prioritized.
  • Choose a standard versioning scheme, and avoid creating major new versions.
  • Decouple view layer and API endpoints to improve maintainability and flexibility.
  • Implement OAuth2 for authentication, and provide clients with enough control to write their own error handling.
  • Make sure to authenticate users and provide error codes that can be easily searched online.
  • Use standards like RFC 7807 for error responses and provide links to further information.
  • Provide reference documentation and ensure it is accurate and up-to-date.
  • Allow clients to rate limit and have a reset mechanism to avoid abuse.
  • Implement authentication and authorization to identify users and applications.
  • Choose a standard format for data exchange, such as JSON or YAML.
  • Provide status codes that can be easily cached and handled by clients.
  • Limit the number of requests per second and provide a reset mechanism to avoid abuse.
  • Use semantics versioning for versioning APIs and avoid breaking backwards compatibility.
  • Use HTTP status codes and provide informative error messages.