How to model file system operations with REST?

Posted by massive on Stack Overflow See other posts from Stack Overflow or by massive
Published on 2010-05-18T19:34:09Z Indexed on 2010/05/18 21:30 UTC
Read the original article Hit count: 165

Filed under:
|
|
|
|

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 REST services - exposing non-data “actions” 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?

© Stack Overflow or respective owner

Related posts about rest

Related posts about restful