*我刚刚开始探索RESTful服务,我发现rest使用基于资源的URI,所以我只是想知道它们之间的区别是什么,基于资源的URI比基于动作的URI有任何优势*
答案 0 :(得分:2)
Action-based URL Resource-based URL
-----------------------------------------------------------------
GET /register GET /accounts/application
POST /register POST /accounts
GET /catalog/search GET /queries/form
POST /catalog/search POST /queries
GET /cart GET /order/123
POST /cart/add-item POST /order/123/items
POST /cart/empty DELETE /order/123
GET /check-out GET /order/123/invoice
POST /check-out POST /order/123/payments
GET /thank-you GET /order/123/receipt
POST /sign-in POST /sessions
POST /admin/delete-user?id=123 DELETE /user/123
GET /catalog/edit?id=123 GET /items/123/form
POST /catalog/edit?id=123 PUT /items/123