[英]How to make REST requests more user friendly like RPC?
I've been highly considering creating a REST service rather than RPC but it seems to me that a client/user will have to write a significant amount of code to achieve the same thing compared with an RPC service. 我一直在考虑创建REST服务而不是RPC,但在我看来,与RPC服务相比,客户端/用户必须编写大量代码才能实现相同的目的。 Moreover, implementing a REST service would require a user some basic knowledge about REST. 此外,实施REST服务将要求用户具有一些有关REST的基本知识。 To illustrate in PHP: 在PHP中进行说明:
REST 休息
RPC RPC
Is there a way to make REST as "easy" as RPC. 有没有办法使REST和RPC一样“容易”。 I'm thinking of encapsulating REST request with RPC methods but that breaks the whole idea isn't it? 我正在考虑使用RPC方法封装REST请求,但这打破了整个想法,不是吗?
REST does not force you to use GET, POST, PUT and DELETE. REST不会强制您使用GET,POST,PUT和DELETE。 it just means that a single URL represents a single content. 它仅表示单个URL表示单个内容。 you can also implement a RESTful behaviour like this: 您还可以实现这样的RESTful行为:
GET /index.php
GET /item.php?id=x
POST /create.php
POST /update.php
POST /delete.php
even create, update and delete could be done with get requests... 甚至创建,更新和删除也可以通过获取请求来完成...
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.