现在我正在为分布式系统设计REST接口.它是一个客户端/服务器架构,但有两种消息交换模式:
在网上搜索我发现一个解决方案可能是在服务器和客户端中实现REST服务器:发布/订阅REST-HTTP简单协议Web服务体系结构?
另一种方法是实现阻塞REST,因此客户端不需要在特定端口中侦听:使用阻塞REST请求来实现发布/订阅
我想知道你会考虑哪些选项来实现像这样的接口.谢谢!
我是第一次设计REST API,所以我认为这是一个关于其设计的基本问题.
我希望文件集合返回所有可用文件资源的ID(或链接),而不是检索完整的表示,因为它将是太多的数据.
GET /files # return the full representation of a collection of resources
GET /files/{id} # return the full representation of a single resource
Run Code Online (Sandbox Code Playgroud)
我不知道将它拆分为两个不同的资源是否更好:
GET /fileids # return only IDs
GET /files/{id} # return the full representation of a single resource
Run Code Online (Sandbox Code Playgroud)
你的方法是什么?