RESTful delete strategy

后端 未结 5 437
走了就别回头了
走了就别回头了 2021-01-11 14:12

Let\'s say I have a resource that can have two different behaviors when delete is called

  1. The resource is deleted.
  2. The resource is moved to the recycl
5条回答
  •  庸人自扰
    2021-01-11 15:06

    A pure REST strategy should prefer non changing resources. In my opinion, you are not changing the resource by appending a parameter, so it sounds like good strategy to me.

    If you were to perform the same action like so:

    DELETE /myresource.force
    

    that would act like another resource, which wouldn't be optimal.

提交回复
热议问题