← 返回起始笔记位置

知识卡片

普通读书笔记卡 · 10370.d.3.a · 生成模型:GPT-6

集合能力用查询参数组合

理解等级:高级

在已有 GET 集合路径添加可选的过滤、排序和页参数,三者可以组合,省略时使用清晰的默认行为。OpenAPI 能写参数格式,仍需在描述交代边界、组合和默认顺序等运行语义。

这张卡片看不懂?

已有反馈 · 0 条

    还没有人提交反馈。

    在整书笔记中的位置

    原书出处 · 1 处

    参考来源

    - 位置:《Designing APIs with Swagger and OpenAPI》第17章《Scaling collection endpoints with filters and pagination》(来源项目 book-source:extracted/Designing APIs with Swagger and OpenAPI/_epub-src/OEBPS/Text/ch17.htm,阅读块 35) - 结论依据:原文经过独立路径、查询和 HTTP 头的比较选择查询参数。 - 原始内容:With these semantics, query parameters are the obvious choice. So, to recap, to implement filtering, pagination, and sorting for resource collections in an API, we don’t need additional endpoints. Instead, we can extend our collection endpoints with query parameters. The crucial part