资源编辑路径在安静的 Web 应用程序上应该是什么样子?
您知道资源编辑路径在安静的 Web 应用程序上应该是什么样子吗?
除了Ruby on Rails 方式之外找不到任何严肃的参考,这只是一个约定。
我不是在谈论用于更新资源的 put 请求,而是通常向用户返回表单或类似形式的路径,以便让他创建并提交更新资源的最终 put 请求。
前面提到的 Ruby on Rails 方式 的一个例子是一个 get 请求:
http://domain.com/resource_name/resource_id/edit
只是想知道是否有一些严肃的参考或解释使这成为一个好的方法。
Do you know how a resource edit path should looks like on a restful web app?
Can't find any serious reference but the Ruby on Rails way that it's just a convention.
I'm not talking about the put request that is used to update the resource but the path that usually returns a form, or similar, to the user to let him create and submit the final put request that updates the resource.
An example of the previously mentioned Ruby on Rails way would be a get request to:
http://domain.com/resource_name/resource_id/edit
Just wondering if there's some serious reference or explanation that makes this a good approach or not.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我认为你的问题有点含糊;但我会尝试一下。
假设您在 http://example.com/planets/earth 上有一个资源。如果您想编辑有关地球的内容,请使用您希望其具有的新表示形式对该 URI 执行 PUT 操作。对于用户来说也是如此: http://example.com/users/JamesKirk。
REST 的重要一点是“编辑”路径根本不被视为路径,它是 HTTP 的方法以及它们如何对您的资源进行操作。
这是一本关于静态 Web 服务主题的好书: RESTful网络服务
Your question is a little vague, I think; but I'll take a stab at it.
Say you have a resource at http://example.com/planets/earth. If you want to edit something about earth, do a PUT to that URI, with the new representation you would like it to have. The same could be said for, say, a user: http://example.com/users/JamesKirk.
The important thing about REST is that the 'edit' path is not seen as a path at all, it is HTTP's methods and how they operate on your resources.
Here's a good book on the subject of restful web services: RESTful Web Services