Resource Movement in RESTful Architecture

I have a RESTful web service that represents processes and actions. Each action takes place within one and only one process. I would like to introduce a “move” operation between the process in which it is currently located and another process.

I look at the forums and found that people suggest using the MOVE operation, which is not very standard, while others suggest using PUT, but then I’m not sure how to tell the difference between PUT that the update and PUT that move that look semantically incorrect.

Any ideas?

+8
rest move
source share
2 answers

If you use PUT, you can determine the difference between whether an existing process matches an existing entity with a new one.

PUT /process1/activity2\n\n process: 2 some_data: and_stuff 

What is the logical answer for (if successful)

 303 See Other\n Location /process2/activity2 
+3
source share

One way could be to represent the move itself as, say, a “transfer” resource (transmission as a noun), and POST a new one:

 POST /transfer 

With an entity containing:

 activity: /activities/4 toProcess: /processes/13 

Thus, clients create new “transfers” that process and verify activity on the server.

This gives you the ability to add transfer information. If you want to keep a history for auditing, you can add the transferredBy property to the resource or the transferredOn date.

+8
source share

All Articles