如何制作get body travel方法?
how to make a get body travel method?
你好我有以下问题,我已经开始研究API和RESTful
我希望你能帮助我。
Get 方法通常通过 uri 发送,例如
http: // example / login? name = Xxxx
但每种方法都必须保持按照方法指示执行操作的标准。
POST update
PUT insert
GET get
DELEATE delete
但如果我必须执行 Get 但数据对 uri 中的传输非常敏感。我应该怎么办?改成Post的方法,让它在体内穿行?
我知道它有像 jwt 这样的安全条款,但在那些情况下,应该怎么做?
I have to do a Get but the data is very sensitive to travel in the uri. what should I do? Change it for a Post method so that it travels in the body?
是的,完全正确。
理论上,我们没有理由不能使用 effectively read only and has a method body; but as of 2020-09 the only registered methods that fit the bill are SEARCH and REPORT 的 HTTP 方法,它们都具有您可能希望避免的 WebDAV 语义。
在缺少具有您需要的语义的标准方法的情况下,it is okay to use POST。
考虑这一点的一种方式是,我们正在使用 POST 使用请求的内容作为参数来创建新资源;新资源将有自己的标识符来掩盖敏感数据。然后您可以随时使用新标识符获取资源的最新表示。
在这个基本想法的基础上,我们添加了在创建新资源时返回其表示形式的想法,并将该资源视为您不需要存储的短暂事物,因为它会立即“消失”使用后(意味着后续尝试获取表示将是 404)。
所以你最终可能会得到这样的回复
201 Created
Location: /random-url-that-has-no-sensitive-information
Content-Location: /random-url-that-has-no-sensitive-information
Cache-Control: no-cache
....
你好我有以下问题,我已经开始研究API和RESTful 我希望你能帮助我。
Get 方法通常通过 uri 发送,例如
http: // example / login? name = Xxxx
但每种方法都必须保持按照方法指示执行操作的标准。
POST update
PUT insert
GET get
DELEATE delete
但如果我必须执行 Get 但数据对 uri 中的传输非常敏感。我应该怎么办?改成Post的方法,让它在体内穿行?
我知道它有像 jwt 这样的安全条款,但在那些情况下,应该怎么做?
I have to do a Get but the data is very sensitive to travel in the uri. what should I do? Change it for a Post method so that it travels in the body?
是的,完全正确。
理论上,我们没有理由不能使用 effectively read only and has a method body; but as of 2020-09 the only registered methods that fit the bill are SEARCH and REPORT 的 HTTP 方法,它们都具有您可能希望避免的 WebDAV 语义。
在缺少具有您需要的语义的标准方法的情况下,it is okay to use POST。
考虑这一点的一种方式是,我们正在使用 POST 使用请求的内容作为参数来创建新资源;新资源将有自己的标识符来掩盖敏感数据。然后您可以随时使用新标识符获取资源的最新表示。
在这个基本想法的基础上,我们添加了在创建新资源时返回其表示形式的想法,并将该资源视为您不需要存储的短暂事物,因为它会立即“消失”使用后(意味着后续尝试获取表示将是 404)。
所以你最终可能会得到这样的回复
201 Created
Location: /random-url-that-has-no-sensitive-information
Content-Location: /random-url-that-has-no-sensitive-information
Cache-Control: no-cache
....