用于验证信息的REST操作(GET,PUT或POST)是什么? [英] Which REST operation (GET, PUT, or POST) for validating information?
问题描述
我的用户在iOS应用中输入一些信息字段。
必须在我的服务器上验证此信息,该服务器具有RESTful API。
验证后,iOS应用的UI会发生变化以指示结果。
My users enter a few information fields in a iOS app. This information must be validated on my server, which has a RESTful API. After validation the UI of the iOS app changes to indicate the result.
GET,PUT或POST似乎都不合适,因为我不是获取资源,并且资源都没有创建或更新。
Neither GET, PUT, or POST seem to be appropriate, because I'm not getting a resource, and neither is a resource created or updated.
实现此验证的最佳拟合REST操作是什么?
What is the best fitting REST operation to implement this validation?
推荐答案
我的用户在iOS应用中输入一些信息字段。必须在我的服务器上验证此信息
,该服务器具有RESTful API。在
验证之后,iOS应用的UI会发生变化以指示结果....我是
没有获得资源,也没有创建或更新资源。
My users enter a few information fields in a iOS app. This information must be validated on my server, which has a RESTful API. After validation the UI of the iOS app changes to indicate the result....I'm not getting a resource, and neither is a resource created or updated.
由于你没有保存任何东西(不修改任何资源),我认为这对我来说在技术上比RPC更多RPC。
Since you aren't saving anything (not modifying any resource), I'd think this is technically more RPC than RESTful to me.
以下是我的意见,所以不要把它作为福音:
The following is my opinion, so don't take it as gospel:
如果信息只是提交>强>你说是或否,而你没有保存,我会说 POST
很好..
If the information is simply being submitted and you're saying yes or no, and you're not saving it, I'd say POST
is fine..
如果实际上正在保存/更新信息,那么选择正确的HTTP方法会更加相关。
If information were actually being saved / updated, then choosing the proper HTTP method would be a lot more relevant.
POST = CREATE / SUBMIT (in an RPC context)
PUT = UPDATE (or CREATE if there is nothing to UPDATE)
这篇关于用于验证信息的REST操作(GET,PUT或POST)是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!