知识卡片

普通读书笔记卡 · 3436.a

资源URL区分单项与集合

理解等级:初级

REST 是围绕资源组织网络接口的架构风格。资源可由唯一 URL 标识;单项资源指一个实体,集合资源指实体列表。例如 /orders/{order_id} 指一个订单,/orders 指订单集合。路径应表达所操作的资源,HTTP 方法再表达操作意图。

这张卡片看不懂?

已有反馈 · 0 / 10 条

    还没有人提交反馈。

    原书出处

    参考来源

    - 位置:《Microservice APIs》第 4 章《Principles of REST API design》(源文件:_epub-src/OEBPS/Text/04.htm) - 结论依据:原文定义 REST 及资源概念,并区分 singleton 和 collection,用订单两个路径给出具体映射。 - 原始内容:REST APIs are structured around resources, entities that can be manipulated through the API. A resource is an entity that can be referenced by a unique hypertext reference (i.e., URL). There are two types of resources: collections and singletons. A singleton represents a single entity, while collections represent lists of entities.