I\'m trying to move a resource from /buckets/1
to /buckets/2
such that:
Answering my own question:
/balls
GET /buckets/1
returning the value of the ball in the bucket let's have it return the URI of the ball instead.We can then move balls as follows:
(examine original state)
GET /buckets/1: "balls = {'/balls/1'}"
GET /buckets/2: "balls = {}"
GET /balls/1: "bucket = /buckets/1"
(move ball into bucket #2)
PUT /balls/1: "bucket = /buckets/2"
(examine new state)
GET /buckets/1: "balls = {}"
GET /buckets/2: "balls = {'/balls/1'}"
GET /balls/1: "bucket = /buckets/2"
End-result: the ball's identity remains consistent as it moves across buckets and (most importantly) this operation is atomic.