POST或GET用于验证REST中的某些数据端点? [英] POST or GET for a validation of some data endpoint in REST?

查看:175
本文介绍了POST或GET用于验证REST中的某些数据端点?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个服务器端点,用于验证某些数据,如果数据验证没有错误,则返回true / false。

I have a server endpoint which validates some data and return true/false if the data validation has no errors.

那么哪个版本更正或更适合RESTful网络服务?

So which Version would be correct or more suitable for a RESTful webservice?

POST https://server.de/validate

在正文中POST数据并在验证没有错误时返回HTTP状态代码200或

POST data in body and return HTTP status code 200 if validation had no errors or

GET https://server.de/validate?=data

发送header或query参数中的数据,并在响应中返回true / false(状态代码200将在正确请求后返回,与数据验证无关)。

Send data in header or query parameter and return true/false in the response (Status code 200 would be returned after a correct request, independent of the data validation).

推荐答案

如果信息敏感,您应该始终使用POST。

You should always use POST if the information is sensitive.

阅读此主题获取更多信息如果您搜索有许多类似的问题:

Read This thread for more information there are many similar question with yours if you search:

编辑/ U pdate:
看到差异的好来源

Edit/Update: a good source for seeing the difference

这篇关于POST或GET用于验证REST中的某些数据端点?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆