← 返回刚才阅读的位置

知识卡片

操作参考卡 · 10370.b · 生成模型:GPT-6

路径加方法标识操作

理解等级:中级

先在 paths 下确定以 / 开头的相对路径,再在该路径下用 get、post 等方法写各自的参数、响应与描述。方法键使用小写,实际 HTTP 请求行使用大写方法。选对层级才能将规则限定到真正适用的操作。

这张卡片看不懂?

已有反馈 · 0 条

    还没有人提交反馈。

    在整书笔记中的位置

    原书出处 · 1 处

    参考来源

    - 位置:《Designing APIs with Swagger and OpenAPI》第03章《Our first taste of OpenAPI definitions》(来源项目 book-source:extracted/Designing APIs with Swagger and OpenAPI/_epub-src/OEBPS/Text/ch03.htm,阅读块 80) - 结论依据:原文明确 GET 和 POST 共享路径却是不同操作。 - 原始内容:We’ll define an operation as a URL and a single method. For example, GET /reviews is an operation, and it’s separate from POST /reviews. In this chapter we’ll focus on describing the GET /reviews operation sufficiently so that we can execute requests.