官术网_书友最值得收藏!

Basics of REST

REST (Representational State Transfer) is an architectural style for creating web services. REST is not standard, but it defines a set of constraints defined by Roy Fielding. The six constraints are the following:

  • Stateless: The server doesn't hold any information about the client state.
  • Client server: The client and server act independently. The server does not send any information without a request from the client.
  • Cacheable: Many clients often request the same resources, therefore it is useful to cache responses in order to improve performance.
  • Uniform interface: Requests from different clients look the same. Clients may be, for example, a browser, a Java application, and a mobile application.
  • Layered system: REST allows us to use a layered system architecture.
  • Code on demand: This is an optional constraint.

The uniform interface is an important constraint and it defines that every REST architecture should have following elements:

  • Identification of resources: There are resources with their unique identifiers, for example, URIs in web-based REST services. REST resources should expose easily understood directory structure URIs. Therefore, a good resource naming strategy is very important.
  • Resource manipulation through representation: When making a request to a resource, the server responds with a representation of the resource. Typically, the format of the representation is JSON or XML.
  • Self descriptive messages: Messages should have enough information that the server knows how to process them.
  • Hypermedia and the Engine of Application State (HATEOAS): Responses can contain links to other areas of service.

The RESTful web service that we are going to develop in the following topics follows the REST architectural principles.

主站蜘蛛池模板: 诏安县| 阜平县| 苏尼特左旗| 交城县| 叙永县| 桑日县| 沂源县| 中宁县| 安溪县| 大埔区| 龙南县| 章丘市| 会同县| 伊宁市| 灌云县| 开江县| 民乐县| 南昌市| 新丰县| 仁化县| 丽水市| 黔江区| 红河县| 芦山县| 长垣县| 东安县| 怀化市| 张家港市| 吉安市| 宜都市| 崇阳县| 密山市| 额尔古纳市| 临澧县| 兴义市| 博白县| 莱阳市| 山西省| 曲松县| 嵊泗县| 景泰县|