RESTful undelete

后端 未结 6 539
失恋的感觉
失恋的感觉 2021-01-30 12:54

It is a fairly common requirement to support undeletes or delayed/batched deletions for data services. What I\'m wondering is how to implement this in a RESTful way. I\'m torn b

6条回答
  •  感情败类
    2021-01-30 13:02

    "Deleted" (trashed) items also may be considered as a resource, right? Then we can access this resource in one of these ways (e.g. for a deleted a user):

    PATCH deleted_users/{id}
    PATCH trash/users/{id}
    PATCH deleted/users/{id}
    

    or some people may think this is more restful way:

    PATCH deleted/{id}?type=users
    

    and in payload goes something like this:

    { deleted_at: null }
    

提交回复
热议问题