知识卡片
超媒体链接引导后续操作
HATEOAS 在资源响应里附上相关链接,让客户端从当前资源发现可继续执行的操作。订单详情可以同时提供取消、付款等操作入口。它把交互路径放进资源表示,适合需要从单一入口逐步导航的 API。
这张卡片看不懂?
这张卡片的反馈已满 10 条,暂时无法继续提交。
已有反馈 · 0 / 10 条
还没有人提交反馈。
原书出处
参考来源
- 位置:《Microservice APIs》第 4 章《Principles of REST API design》(源文件:_epub-src/OEBPS/Text/04.htm)
- 结论依据:原文把 HATEOAS 定义为强调可发现性的 REST 范式,要求响应携带相关链接,并以订单取消和付款链接举例。
- 原始内容:Hypermedia as the engine of application state (HATEOAS) is a design paradigm of REST that emphasizes the idea of discoverability. Whenever a client requests a resource from the server, the response must contain a list of related links to the resource. For example, if a client requests the details of an order, the response must include the links to cancel and pay for the order.