有/group/1并且是/group/2的/item/42成员/group/1。我想从中删除/item/42并将/group/1其放入/group/2. 我目前的解决方案是这样的:
GET /group/1/item/42 => Get the item from the first group
POST /group/2/item => Create a clone of the item in the 2nd group
DELETE /group/1/item/42 => Delete the original item from the 1st group
这个解决方案有(至少)两个严重的问题:
- 如果客户端在 之前停止
DELETE,则该项目将成为两个组的成员。 - 项目的 ID 在 中不会相同
/group/2,这看起来好像项目会失去其身份。
如果我想在一个步骤中更改项目的组成员身份(如果可能,保留其身份),我应该如何重新设计 API?