There is /group/1
and /group/2
, and /item/42
is a member of /group/1
. I would like to remove /item/42
from /group/1
and put it into /group/2
. My current solution is this:
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
There are (at least) two serious problems with this solution:
- If the client stops before the
DELETE
, the item will become a member of both groups. - The ID of the item won't be the same in
/group/2
, which looks as if the item would lose its identity.
How should I redesign the API if I want to change an item's group membership in a single step (with retaining its identity, if possible)?