简体   繁体   English

REST和DELETE - >传递参数

[英]REST and DELETE -> passing parameters

So this question has been asked numerous times in SO and elsewhere. 因此,在SO和其他地方已经多次询问过这个问题。 On SO this is probably the question with the most comprehensive answers and comments. 在SO上,这可能是最全面的答案和评论的问题。
REST, HTTP DELETE and parameters REST,HTTP DELETE和参数

In my scenario I want to add information to a delete request, not to identify the resource, but as meta data. 在我的场景中,我想向删除请求添加信息,而不是识别资源,而是作为元数据。 Specifically, just some additional data the delete operation should record in a log. 具体来说,删除操作应该在日志中记录一些额外的数据。

Based on everything I've read putting any parameters as part of the DELETE request goes against best practices. 根据我读过的所有内容,将任何参数作为DELETE请求的一部分进行反对最佳实践。 What would be the best practice in this scenario? 在这种情况下,最佳做法是什么?

Metadata by its very name is data about a Resource. 元数据的名称是有关资源的数据。 Using HTTP, such data belongs into HTTP headers. 使用HTTP,此类数据属于HTTP标头。

Since the X- prefix is deprecated , just choose sensible header names for your metadata. 由于不推荐使用X-前缀 ,因此只需为元数据选择合理的标题名称即可。

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

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