There are obvious counterparts for some of file systems' basic operations (eg. ls
and rm
), but how would you implement not straightforwardly RESTful actions such as cp
or mv
?
As answers to the question How to implement copy paste of a resource in REST? suggest, the preferred way of implementing cp
would include GETting the resource, DELETing it and PUTting it back again with a new name.
But what if I would need to do it efficiently? For instance, if the resource's size would be huge? How would I eliminate the superfluous transmission of resource's payload to client and back to the originating server?
Here is an illustration. I have a resource:
/videos/my_videos/2-gigabyte-video.avi
and I want copy it into a new resource:
/videos/johns_videos/copied-2-gigabyte-video.avi
How would I implement the copy, move or other file system actions the RESTful way? Or is there even a proper way? Am I doing it all wrong?