简体   繁体   English

在REST Web服务中使用什么方法

[英]What method to use in rest webservice

I am developing an restful webservice for an app as follows: 我正在为应用程序开发一个宁静的Web服务,如下所示:

I have a bunch of images that needs to be processed by the rest client, but when I ask for these images they are signed in the database by the server, so it is not retrieved twice by the clients. 我有一堆需要其余客户端处理的图像,但是当我要求这些图像时,它们是由服务器在数据库中签名的,因此客户端不会两次对其进行检索。 I have a question, since GET must be idempotent what method is the best for this operation? 我有一个问题,因为GET必须是幂等的,哪种方法最适合此操作? Should I consider GET anyway, since if the same client requests the images it receives the same images? 我是否仍应考虑GET,因为如果相同的客户端请求图像,则它会接收相同的图像?

I was thinking of something like: 我在想类似的东西:

/images/assign / images / assign

But I am not sure what is the best method to use in this case. 但是我不确定在这种情况下使用哪种最佳方法。

I think that 'get' is fine. 我认为“获取”很好。 It is up to you if some method is either save or idempotent. 某些方法是保存还是幂等取决于您。 So you can implement get in order to what you want to get. 因此,您可以实现get以实现您想要的目标。

You do no modify your resource by sending it to the client, so you can use get method. 您无需通过将资源发送给客户端来修改资源,因此可以使用get方法。

Is it helpfull? 有帮助吗?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM