使用POST作为URL字符限制的解决方法 [英] Using POST as a workaround for the URL character limit

查看:149
本文介绍了使用POST作为URL字符限制的解决方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果您仅因为URL长度限制和在请求中传递复杂参数而拥有API并支持POST操作,您还能说您拥有RESTful体系结构吗?

If you have an API and support the POST operation only because of URL length limitations and the passing of complex parameters in the request, can you still say that you have a RESTful architecture?

以上内容基本上意味着,对于此特定的(只读)API,GET和POST之间没有语义上的区别,因此GET可以完成的操作也可以通过POST进行(但不能反之亦然(由于限制).

What the above basically implies is that for this particular (read-only) API, there is no semantic difference between a GET and a POST, so what can be done with a GET can also be done with a POST (but not vice versa due to the limitations).

这还会使体系结构的样式成为RESTful吗?

Would this still make the style of the architecture a RESTful one?

推荐答案

从技术上讲,您没有违反任何约束.但是,您正在严重降低请求的自我描述性.这将导致无法缓存响应.能够缓存响应是构建有效的REST系统所需的一项基本功能.

Technically you are not violating any constraints. However you are severely reducing the self-descriptiveness of requests. This will result in the loss of the ability to cache responses. Being able to cache responses is an essential feature that is needed to build effective REST systems.

这篇关于使用POST作为URL字符限制的解决方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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