基于功能的服务的 REST 约定
REST convention for function based services
实体的典型 REST 端点服务如下所示。
GET /products (list)
GET /products/:id (detail of a specific product)
POST /products (insert)
PUT /products/:id (update)
DELETE /products/:id (delete)
但如果我需要 return 一些自定义结果,例如
SELECT MAX(lastModified) FROM product
您将如何根据上述或类似的自定义结果形成 REST 请求(方法 + URL)?
如果您只对产品列表中的 "lastModifed" 产品感兴趣(即带有 MAX(lastModified) 的产品),那么:
GET /products/lastModified
实体的典型 REST 端点服务如下所示。
GET /products (list)
GET /products/:id (detail of a specific product)
POST /products (insert)
PUT /products/:id (update)
DELETE /products/:id (delete)
但如果我需要 return 一些自定义结果,例如
SELECT MAX(lastModified) FROM product
您将如何根据上述或类似的自定义结果形成 REST 请求(方法 + URL)?
如果您只对产品列表中的 "lastModifed" 产品感兴趣(即带有 MAX(lastModified) 的产品),那么:
GET /products/lastModified