← 返回刚才阅读的位置

知识卡片

普通读书笔记卡 · 3216.b

超媒体导航需权衡交互成本

理解等级:高级

REST 的超媒体控制让响应告诉消费者接下来可做什么,适合需要动态导航的界面。服务间调用常预先知道接口规范,若为发现下一步而增加请求,可能带来冗余往返。是否采用 HATEOAS 要看消费者是否真的需要运行时发现,而不是机械追求最高成熟度。

这张卡片看不懂?

已有反馈 · 0 条

    还没有人提交反馈。

    在整书笔记中的位置

    原书出处 · 1 处

    • · 查看原书依据

      In practical terms level 3 is rarely used in modern RESTful HTTP services, and although the navigation is a benefit in flexible UI style systems, it doesn’t suit interservice API calls. Using HATEOAS would be a chatty experience and is often short-circuited by having a complete specification of possible interactions up front while programming against the producer.

    参考来源

    - 位置:《Mastering API Architecture》第1章《Design, Build, and Specify APIs》之《The Richardson Maturity Model》(源文件:_epub-src/OEBPS/ch01.xhtml) - 结论依据:原文解释 Level 3 的响应可包含更新与删除等动作,又指出这种导航在界面场景有利、在服务间调用中常显得冗长。 - 原始内容:In practical terms level 3 is rarely used in modern RESTful HTTP services, and although the navigation is a benefit in flexible UI style systems, it doesn’t suit interservice API calls. Using HATEOAS would be a chatty experience and is often short-circuited by having a complete specification of possible interactions up front while programming against the producer.