知识卡片

问题卡 · 3216.g

相关动作资源按需展开

理解等级:中级

当一次响应有太多可能动作,可返回常用动作及一个related入口,另一个资源按当前数据、服务、流程和身份上下文列出完整可用动作。客户端找不到目标动作时再跟随该入口。

这减少每个响应重复携带大量表单的成本,但代价是额外往返;不应把所有动作都藏掉。动作列表会随上下文变化,不能把旧列表当永久授权。

这张卡片看不懂?

已有反馈 · 0 / 10 条

    还没有人提交反馈。

    在整书笔记中的位置

    原书出处 · 1 处

    • 超媒体工作流 · 查看原书依据

      A simple way to solve the “too many links in the response” challenge is to expose a separate resource that always lists all the possible actions at any single moment in time for the application. You can do this via the related IANA link relation value.

    参考来源

    - 位置:《RESTful Web API Patterns and Practices Cookbook Connecting and Orchestrating Microservices and Distributed Data (Mike Amundsen)》第7章《超媒体工作流》§7.8(来源项目:book-sources;源文件:extracted/RESTful Web API Patterns and Practices Cookbook Connecting and Orchestrating Microservices and Distributed Data (Mike Amundsen)/_epub-src/OEBPS/ch07.xhtml) - 结论依据:原文以当一次响应有太多可能动作,可返回常用动作及一个related入口,另一个资源按当前数据、服务、流程和身份上下文列出完整可用动作的方式说明该用途;同节示例与讨论补充了卡内条件和边界。 - 原始内容:A simple way to solve the “too many links in the response” challenge is to expose a separate resource that always lists all the possible actions at any single moment in time for the application. You can do this via the related IANA link relation value.