Building RESTful Web Services with .NET Core
上QQ阅读APP看书,第一时间看更新

REST characteristics

The main building blocks of web services are the client and server architectures. The response sent from the server is actually a reply to the client's request. It's like you are asking a question and the server responds if it finds the answer. The response that comes from the server is actually a resource in a certain format or representation. The formats that are usually seen are .json, .xml, .pdf, .doc, and so on. 

REST is stateless. Stateless means that the state of the system is always different. So, when a request comes to the server, it is served and forgotten. Thus, the next request does not depend on the state of the previous one. Each request is handled by the server independently.

The requests are performed in an HTTP connection. They each take the form of a uniform resource identifier (URI). This identifier helps us to locate the required resource on the web server.

Roy Fielding’s PhD dissertation, entitled Architectural Styles and the Design of Network-Based Software Architectures, defined REST. The following are some key points extracted from his research:

  • Like many distributed architectures, REST imposes layers, statelessness, and caching.
  • REST improves efficiency, interoperability, and overall performance.
  • REST introduces uniformity by following a set of rules on how to identify and manipulate resources, along with the process to simplify the description about its operations through metadata so that the messages passed will be self-explanatory. We will talk more about this uniformity, which is called the uniform interface.
  • As REST is an architectural style, a service can be developed using any language or platform as long as it supports HTTP.

You can read the whole dissertation at https://www.ics.uci.edu/~fielding/pubs/dissertation/top.htm