← 返回刚才阅读的位置

知识卡片

问题卡 · 5025.a

按超媒体控制发请求

理解等级:中级

服务会随权限和资源状态改变可用动作,客户端不能永久固化这些调用细节。

超媒体控制把下一步请求的地址、方法、编码与参数交给响应描述;客户端识别动作语义后使用这些实时细节。例如REQUEST WITH-FORM taskFormEdit WITH-STACK把已修改数据填入当前响应的编辑表单。

H-Factor可检查格式能表达多少调用信息:LE嵌入、LO外跳、LT模板、LN非幂等、LI幂等链接,以及CR读、CU写、CM方法、CL关系控制。支持不足的部分仍需本地知识;普通JSON本身没有这些控制,不能仅因返回JSON就声称解耦。

关联:[[响应元素的四类标识]]、[[用词汇契约识别动作]]。

这张卡片看不懂?

已有反馈 · 0 条

    还没有人提交反馈。

    在整书笔记中的位置

    原书出处 · 1 处

    • 超媒体客户端 · 查看原书依据

      The advantage of relying on supplied hypermedia in your scripts is that you reduce the amount of hardcoding you need to do within your client application. You can make it easier for services to modify hypermedia details (e.g., URLs, HTTP methods, supported formats, etc.) without breaking the client application. In the preceding example, the script does not hardcode the HTTP URL, method, or encoding type for the taskFormEdit action. It simply uses the details supplied by the service.

    参考来源

    - 位置:《RESTful Web API Patterns and Practices Cookbook》第4章《Hypermedia Clients》(来源项目book-sources:extracted/RESTful Web API Patterns and Practices Cookbook Connecting and Orchestrating Microservices and Distributed Data (Mike Amundsen)/_epub-src/OEBPS/ch04.xhtml,配方4.9) - 结论依据:原文列出九种H-Factor,并用taskFormEdit示例说明客户端可从控制中取得URL、方法和编码。 - 原始内容:The advantage of relying on supplied hypermedia in your scripts is that you reduce the amount of hardcoding you need to do within your client application. You can make it easier for services to modify hypermedia details (e.g., URLs, HTTP methods, supported formats, etc.) without breaking the client application. In the preceding example, the script does not hardcode the HTTP URL, method, or encoding type for the taskFormEdit action. It simply uses the details supplied by the service.