Enlist some important constraints for RESTful web services

Technology CommunityCategory: API DesignEnlist some important constraints for RESTful web services
VietMX Staff asked 3 years ago

Every constraint has positive as well as negative impacts and to produce an overall architecture, there should be the balance between both of them. Below mentioned are some important constraints for RESTful web service:

  • There should be separate concerns for each server and client which will help to maintain the modularity within the application. This will also reduce the complexity and increase the scalability.
  • The client-server communication should be stateless, which means no previous information is used and the complete execution is done in isolation. In cases of failure, it also helps the client to recover.
  • In client-server communication, the HTTP response should be cacheable so that when required cached copy can be used which in turn enhances the scalability and performance of the server.
  • The fourth constraint is the uniform interface which allows client-server interaction to be easily understood. This constraint is further divided into four sub-constraints as:
    • Resource Identification
    • Resource manipulation
    • Each message is easily understood and is self-descriptive.
    • Hypermedia, which is defined as the text with hyperlinks and when clicked it moves to another application state.
  • Client-server communication should be done on a layered system and thus the client should only have knowledge about the intermediate level with which communication is being done.