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

Conventions of RESTful web services

RESTful web services are based on RESTful resources. A RESTful resource is an entity/resource that is mostly stored on a server and that client request using RESTful web services. Here are a few characteristics of a resource in terms of RESTful web services:

  • It is an entity normally referred as a noun in the URL
  • It is unique
  • It has data associated with it
  • It has at least one URI

If you are still wondering what exactly is a resource, consider the example of a blog. In a blog system, a Post, User, Category, or Comment can be a resource. In a shopping cart, a Product, Category, or an Order can be a resource. In fact, any entity which a client is requesting from the server is a resource.

Most commonly, there are five typical operations which can be performed on a resource:

  • List
  • Create
  • Read
  • Update
  • Delete

For each operation, we need two things: the URI and HTTP method or verb.

The URI contains a resource name that is a noun and the HTTP method that is a verb. To perform some operation on an entity, we need to have a noun that tells us which entity we need to perform some operation. We also need to specify a verb to tell us what operation we want to perform.

For the preceding mentioned operations, there is a URL convention that we use with HTTP verbs and resource names. In the next section, we will review the URL structure and HTTP verbs for each operation.

主站蜘蛛池模板: 突泉县| 清苑县| 永顺县| 吉木萨尔县| 新干县| 潼南县| 荆门市| 准格尔旗| 淳化县| 宜州市| 铅山县| 孝昌县| 盘锦市| 礼泉县| 墨江| 沾益县| 驻马店市| 大洼县| 新兴县| 二连浩特市| 内江市| 高碑店市| 博罗县| 开鲁县| 大兴区| 云安县| 木里| 铁岭县| 利津县| 油尖旺区| 金溪县| 枣阳市| 双桥区| 贞丰县| 平安县| 遂宁市| 新丰县| 梧州市| 永宁县| 香港 | 玉树县|