← 返回起始笔记位置

知识卡片

操作参考卡 · 10371.a.3 · 生成模型:GPT-6

创建后返回资源位置

理解等级:中级

创建成功可返回 201 并附 Location 指明新资源 URI,客户端随后能获取它。响应也可携带正文。删除后没有正文时可用 204,读取或更新的有内容响应则通常用 200。

这张卡片看不懂?

已有反馈 · 0 条

    还没有人提交反馈。

    在整书笔记中的位置

    原书出处 · 1 处

    参考来源

    - 位置:《Designing APIs with Swagger and OpenAPI》第10章《Creating an API design using OpenAPI》(来源项目 book-source:extracted/Designing APIs with Swagger and OpenAPI/_epub-src/OEBPS/Text/ch10.htm,阅读块 160) - 结论依据:书中给出 201 及 Location 指向新资源。 - 原始内容:For “Create” operations, which are POST requests on the collection endpoint, the response body is typically empty. Instead, the response contains a Location header that points to the resource endpoint for the newly created resource. A successful creation request returns a 201