REST API best practices

What is a REST API?

REST stands for representational state transfer and it is an architectural style. REST API is the design principles of REST how applications or devices can connect to and communicate with each other.

Computer scientist Dr. Roy Fielding first explained REST in 2000.

Best practices

  • Accept JSON
  • Use plural nouns for collections
  • Use nouns instead of verbs for endpoints
  • Nesting resources for hierarchical objects
  • Gracefully handle errors
  • Always return standard error codes
  • Maintain Good Security Practices
  • Allow filtering, sorting, and pagination
  • Cache data to improve performance
  • Versioning the APIs
  • APIs should have complete documentation
Reference: