且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

API在查询字符串中需要POST参数吗?

更新时间:2023-11-07 23:42:28

任一选项都同样有效。我最喜欢在POST的URL中使用参数的示例是在地图上设置航点的应用程序。例如

Either option is just as valid. My favourite example for using parameters in the URL for a POST is an application that sets waypoints on a map. e.g.

     POST /map/route/45/waypoints?lat=35&long=74

在这种情况下,参数在URI中作为位置的标识符更有意义,而不仅仅是在正文中传递给通用资源的参数。

In this case, the parameters make more sense in the URI as identifiers of a location, than just parameters being passed in the body to generic resource.