Non-CRUD operations in a RESTful service

前端 未结 4 1817
梦谈多话
梦谈多话 2020-12-02 05:13

What is the \"RESTful\" way of adding non-CRUD operations to a RESTful service? Say I have a service that allows CRUD access to records like this:

GET /api/         


        
4条回答
  •  时光说笑
    2020-12-02 06:07

    What you're really doing is creating an order. So add another resource for order and post and put there during the order process.

    Think in terms of resources rather than method calls.

    To finalize the order you'd probably POST /api/order//complete or something similar.

提交回复
热议问题