在RESTful架构中移动资源 [英] Move resource in RESTful architecture
问题描述
我有一个RESTful Web服务,代表流程和活动.每个活动都在一个过程中,并且只有一个过程. 我想代表当前活动流程与另一个流程之间的活动移动"操作.
I have a RESTful web service which represent processes and activities. Each activity is inside one and only one process. I would like to represent a "move" operation of activity between the process it is currently in and another process.
我看过论坛,发现人们建议使用不是很标准的MOVE操作,其他建议使用PUT,但是我不确定如何分辨更新的PUT和移动的PUT之间的区别.在语义上是错误的.
I've look at forums and found people suggest to use MOVE operation which is not very standard and other suggest to use PUT but then I'm not sure how to tell the difference between PUT that update and PUT that moves which looks semantically wrong.
有什么想法吗?
推荐答案
如果使用PUT,则可以通过现有实体的过程是否与新实体匹配来区分两者.
If using PUTs, you can tell the difference by whether the process of the existing entity matches the new one.
PUT /process1/activity2
process: 2
some_data: and_stuff
对其进行逻辑响应(如果成功)的
To which the logical response (if successful) is
303 See Other
Location: /process2/activity2
这篇关于在RESTful架构中移动资源的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!