This best-practices article intends for developers interested in creating RESTful Web services that provide high reliability and consistency across multiple service suites; following these guidelines; services are positioned for rapid, widespread, public adoption by internal and external clients. By Love Sharma.
Article begins with elaborating on each box by starting with its principles:
- The six principles / constraints
- Client-Server: Separation of concerns is the principle behind the client-server constraints.
- Stateless: communication must be stateless, as in the client-stateless-server (CSS) style
- Cacheable: To improve network efficiency
- Layered system: A client cannot ordinarily tell whether it is connected directly to the end server or an intermediary along the way
- Code-on-demand: REST allows client functionality to extend by downloading and executing code in the form of applets or scripts
- Uniform interface
- Best Practices
- Keep it simple and fine-grained
- Filtering & ordering: For large data sets, limiting the amount of data returned is vital from a bandwidth standpoint
- Versioning: There are many ways to break a contract and negatively impact your clients in API development for any given resource.
- Pagination: One of the principles of REST is connectedness – via hypermedia links
- Resource-naming
- Monitoring: Make sure to add all kinds of monitoring to improve the quality or performance of your API
- Security: Authorization / authentication, CORS, TLS, Idempotence
… and much more. Also consider self-descriptive messages: Each message includes enough information to describe how to process the message. Create APIs that mimic your system’s underlying application domain or database architecture of your system. Eventually, you’ll want aggregate services — services that utilize multiple underlying resources to reduce chattiness. Good read!
[Read More]