cp a bGiven a file named a, the command creates a new file named b that has the same content as a. Similarly, we can clone a resource A. The client sends the following request to the server.
PUT /resources/BHowever, a client normally does not have the knowledge to properly name a new resource. A more reasonable alternative is the following request.
POST /resourcesAll these are straightforward, but really smell like RPC. They did not follow the REST constraint of self-descriptive message. How could the server figure out /resources/A is what the client wants. What if the resource has been changed or deleted after the request was sent out? The following approach may be better:
POST /resourcesWhat if the representation is huge? Maybe we can do the following:
the representation of /resources/A