¥
立即购买

RESTful API端点设计器

447 浏览
42 试用
10 购买
Nov 24, 2025更新

根据用户指定的资源类型、操作类型及认证级别,设计符合RESTful规范的API端点,包含URL模式、HTTP方法、请求/响应格式及认证要求,生成可直接用于开发的标准化接口设计文档,支持快速迭代和扩展。

API设计:知识库文章

基本信息

  • 资源名称:知识库文章(Article)
  • 基础路径:/api/v1/articles
  • 认证要求:所有端点需认证用户(Authorization: Bearer
  • 媒体类型:请求/响应均为JSON
  • 通用请求头:
    • Authorization: Bearer
    • Content-Type: application/json
    • Accept: application/json

资源模型(Article)

  • id: string(UUID)
  • title: string(1-200)
  • content: string
  • summary: string(0-500) 可选
  • tags: string[] 可选
  • category_id: string(UUID) 可选
  • status: string 枚举["draft","published","archived"],默认"draft"
  • author_id: string(UUID) 只读
  • created_at: string(ISO8601) 只读
  • updated_at: string(ISO8601) 只读
  • published_at: string(ISO8601) 可选,仅当status="published"时存在

错误响应格式

  • 状态码:4xx/5xx
  • 响应体:
    • error.code: string
    • error.message: string
    • error.details: object | array 可选

示例:

{
  "error": {
    "code": "VALIDATION_ERROR",
    "message": "title is required",
    "details": { "title": ["must not be empty"] }
  }
}

分页与查询约定

  • 分页参数:
    • page: integer ≥1,默认1
    • per_page: integer 1-100,默认20
  • 过滤与搜索:
    • q: string 模糊搜索(title, summary, content)
    • tags: string 多值以逗号分隔,如 "api,rest"
    • category_id: string(UUID)
    • status: string["draft","published","archived"]
    • author_id: string(UUID)
  • 排序:
    • sort: string,字段名或带前缀"-"表示倒序;支持:"created_at","-created_at","updated_at","-updated_at","title","-title"

端点总览

  • GET /api/v1/articles
  • POST /api/v1/articles
  • GET /api/v1/articles/{article_id}
  • PATCH /api/v1/articles/{article_id}
  • DELETE /api/v1/articles/{article_id}

GET /api/v1/articles

  • 功能:列表读取
  • 认证:需要
  • 请求
    • 查询参数:
      • page, per_page, q, tags, category_id, status, author_id, sort(见约定)
    • 示例:
      GET /api/v1/articles?page=1&per_page=20&status=published&sort=-created_at
      
  • 响应
    • 200 OK
    • 响应体:
      • data: Article[]
      • meta:
        • page: integer
        • per_page: integer
        • total: integer
        • total_pages: integer
    • 示例:
      {
        "data": [
          {
            "id": "a1b2c3d4-...-0001",
            "title": "RESTful API设计规范",
            "summary": "最佳实践与示例",
            "content": "...",
            "tags": ["api","rest"],
            "category_id": "c9f3...001",
            "status": "published",
            "author_id": "u7e2...111",
            "created_at": "2025-11-24T09:00:00Z",
            "updated_at": "2025-11-24T10:00:00Z",
            "published_at": "2025-11-24T10:00:00Z"
          }
        ],
        "meta": {
          "page": 1,
          "per_page": 20,
          "total": 135,
          "total_pages": 7
        }
      }
      

POST /api/v1/articles

  • 功能:创建
  • 认证:需要
  • 请求
    • 请求体:
      • title: string 必填
      • content: string 必填
      • summary: string 可选
      • tags: string[] 可选
      • category_id: string(UUID) 可选
      • status: string 可选,默认"draft"
    • 示例:
      {
        "title": "如何设计高质量API",
        "content": "正文内容...",
        "summary": "简要概述",
        "tags": ["api","design"],
        "category_id": "c9f3...001",
        "status": "draft"
      }
      
  • 响应
    • 201 Created
    • Headers:
      • Location: /api/v1/articles/{article_id}
    • 响应体:Article
    • 示例:
      {
        "id": "a1b2c3d4-...-0002",
        "title": "如何设计高质量API",
        "summary": "简要概述",
        "content": "正文内容...",
        "tags": ["api","design"],
        "category_id": "c9f3...001",
        "status": "draft",
        "author_id": "u7e2...111",
        "created_at": "2025-11-24T11:00:00Z",
        "updated_at": "2025-11-24T11:00:00Z",
        "published_at": null
      }
      
    • 错误:
      • 400 Bad Request(校验失败)
      • 401 Unauthorized(未认证)

GET /api/v1/articles/{article_id}

  • 功能:单条读取
  • 认证:需要
  • 路径参数:
    • article_id: string(UUID)
  • 响应
    • 200 OK
    • 响应体:Article
    • 错误:
      • 401 Unauthorized
      • 404 Not Found(不存在或无访问权限)

PATCH /api/v1/articles/{article_id}

  • 功能:部分更新
  • 认证:需要
  • 授权规则:
    • 资源所属作者或具有相应权限的认证用户可更新
  • 路径参数:
    • article_id: string(UUID)
  • 请求
    • 请求体(任意字段的子集):
      • title: string
      • content: string
      • summary: string
      • tags: string[]
      • category_id: string(UUID)
      • status: string["draft","published","archived"]
    • 示例:
      {
        "status": "published",
        "published_at": "2025-11-24T12:00:00Z"
      }
      
  • 响应
    • 200 OK
    • 响应体:Article
    • 错误:
      • 400 Bad Request(校验失败)
      • 401 Unauthorized
      • 403 Forbidden(无权限)
      • 404 Not Found

DELETE /api/v1/articles/{article_id}

  • 功能:删除
  • 认证:需要
  • 授权规则:
    • 资源所属作者或具有相应权限的认证用户可删除
  • 路径参数:
    • article_id: string(UUID)
  • 响应
    • 204 No Content
    • 错误:
      • 401 Unauthorized
      • 403 Forbidden
      • 404 Not Found

状态码与行为摘要

  • 成功:200 OK(读取/更新)、201 Created(创建)、204 No Content(删除)
  • 客户端错误:400 Bad Request、401 Unauthorized、403 Forbidden、404 Not Found
  • 服务器错误:500 Internal Server Error

安全与权限

  • 认证方式:Bearer Token(Authorization: Bearer
  • 授权建议:
    • 创建:认证用户
    • 读取:认证用户
    • 更新/删除:资源所有者或有管理权限的认证用户

商品目录条目(Catalog Items)RESTful API 设计

版本:v1
基路径:/api/v1
资源:/catalog-items

认证要求(全局):

  • 所有端点需管理员认证
  • Authorization: Bearer (需 admin 角色或 scope: catalog:admin)
  • 未认证返回 401,权限不足返回 403

通用请求头(除特别说明外均适用):

  • Accept: application/json
  • Content-Type: application/json(含请求体时)
  • X-Request-Id: 可选,用于追踪
  • Idempotency-Key: 建议在创建接口使用,避免重复创建(幂等)

通用响应头:

  • X-Request-Id: 请求追踪ID
  • ETag: 资源实体标签(用于并发控制)
  • Location: 资源创建成功时返回新资源URL(POST)

并发控制:

  • 更新接口必须携带 If-Match: ,否则返回 428 Precondition Required
  • ETag 不匹配返回 412 Precondition Failed

错误响应格式(统一):

  • 状态码:4xx/5xx
  • Body: { "error": { "code": "string", "message": "string", "details": { "field": "error detail" }, "request_id": "string" } }

资源数据模型(JSON,响应中 data 字段):

  • CatalogItem
    • id: string(UUID)
    • sku: string
    • name: string
    • description: string
    • category_id: string
    • status: string [draft, active, archived]
    • price: { amount: number, currency: string }
    • stock: integer
    • images: [{ url: string, alt: string, is_primary: boolean, sort_order: integer }]
    • attributes: object (键值对,string/number/boolean)
    • dimensions: { length: number, width: number, height: number, unit: string }
    • weight: { value: number, unit: string }
    • tags: [string]
    • seo: { title: string, description: string, keywords: [string] }
    • variants: [{ id: string(UUID), sku: string, name: string, attributes: object, price_delta: number, images: [{ url: string, alt: string }] }]
    • created_at: string(ISO-8601)
    • updated_at: string(ISO-8601)
    • created_by: string
    • updated_by: string

字段风格:snake_case
时间格式:ISO-8601(UTC)

分页与查询约定(列表接口适用):

  • 分页:page(默认1),per_page(默认20,最大100)
  • 排序:sort,示例 sort=-created_at,name(负号表示降序)
  • 选择字段:fields=field1,field2
  • 关联展开:include=variants,images
  • 结果包装:{ "data": [...], "meta": { "total": number, "page": number, "per_page": number }, "links": { "self": "...", "next": "...", "prev": "..." } }

通用状态码:

  • 200 OK / 201 Created / 204 No Content
  • 400 Bad Request / 401 Unauthorized / 403 Forbidden / 404 Not Found
  • 409 Conflict(如 SKU 冲突)/ 412 Precondition Failed(ETag 不匹配)/ 422 Unprocessable Entity(校验失败)/ 428 Precondition Required(缺少 If-Match)

端点清单

  • GET /catalog-items
  • GET /catalog-items/{item_id}
  • POST /catalog-items
  • PUT /catalog-items/{item_id}
  • PATCH /catalog-items/{item_id}
  1. 列表查询商品目录条目
  • 路径与方法
    • GET /api/v1/catalog-items
  • 认证要求
    • Admin Bearer Token(scope: catalog:admin)
  • 请求参数(Query)
    • page: integer, 默认 1
    • per_page: integer, 默认 20,最大 100
    • sort: string,例:-created_at,name
    • fields: string,逗号分隔字段,例:id,sku,name,price,status
    • include: string,可选项:variants,images
    • q: string,全文检索关键词(name/sku/description)
    • category_id: string
    • status: string,枚举:draft,active,archived
    • sku: string(精确匹配)
    • price_min: number
    • price_max: number
    • updated_from: string(ISO-8601)
    • updated_to: string(ISO-8601)
  • 请求头
    • Accept: application/json
    • Authorization: Bearer
  • 响应(200) { "data": [ { "id": "uuid", "sku": "SKU-001", "name": "string", "status": "active", "price": { "amount": 199.0, "currency": "CNY" }, "updated_at": "2025-01-01T10:00:00Z" } ], "meta": { "total": 123, "page": 1, "per_page": 20 }, "links": { "self": "/api/v1/catalog-items?page=1&per_page=20", "next": "/api/v1/catalog-items?page=2&per_page=20", "prev": null } }
  • 可能的错误
    • 400(参数非法)/401/403
  1. 获取单个商品目录条目
  • 路径与方法
    • GET /api/v1/catalog-items/{item_id}
  • 路径参数
    • item_id: string(UUID)
  • 查询参数
    • fields: string
    • include: string(variants,images)
  • 请求头
    • Accept: application/json
    • Authorization: Bearer
  • 响应(200) { "data": { "id": "uuid", "sku": "SKU-001", "name": "string", "description": "string", "category_id": "uuid", "status": "active", "price": { "amount": 199.0, "currency": "CNY" }, "stock": 100, "images": [{ "url": "https://...", "alt": "string", "is_primary": true, "sort_order": 1 }], "attributes": { "color": "red", "size": "M" }, "dimensions": { "length": 10, "width": 5, "height": 2, "unit": "cm" }, "weight": { "value": 0.5, "unit": "kg" }, "tags": ["tag1", "tag2"], "seo": { "title": "string", "description": "string", "keywords": ["k1","k2"] }, "variants": [], "created_at": "2025-01-01T10:00:00Z", "updated_at": "2025-01-02T10:00:00Z", "created_by": "admin_id", "updated_by": "admin_id" } }
  • 响应头
    • ETag: ""
  • 可能的错误
    • 401/403/404
  1. 创建商品目录条目
  • 路径与方法
    • POST /api/v1/catalog-items
  • 认证要求
    • Admin Bearer Token(scope: catalog:admin)
  • 请求头
    • Content-Type: application/json
    • Accept: application/json
    • Authorization: Bearer
    • Idempotency-Key: string(推荐)
  • 请求体(JSON) { "sku": "SKU-001", "name": "string", "description": "string", "category_id": "uuid", "status": "draft", "price": { "amount": 199.0, "currency": "CNY" }, "stock": 100, "images": [{ "url": "https://...", "alt": "string", "is_primary": true, "sort_order": 1 }], "attributes": { "color": "red", "size": "M" }, "dimensions": { "length": 10, "width": 5, "height": 2, "unit": "cm" }, "weight": { "value": 0.5, "unit": "kg" }, "tags": ["tag1","tag2"], "seo": { "title": "string", "description": "string", "keywords": ["k1","k2"] }, "variants": [{ "sku": "SKU-001-RED-M", "name": "string", "attributes": { "color": "red", "size": "M" }, "price_delta": 10.0, "images": [{ "url": "https://...", "alt": "string" }] }] }
  • 字段规则(示例)
    • sku: 必填,唯一,string(1-64)
    • name: 必填,string(1-255)
    • status: 可选,默认 draft
    • price.amount: 必填,>=0
    • price.currency: 必填,ISO-4217
    • stock: 可选,默认0,>=0
  • 成功响应(201)
    • 响应头:Location: /api/v1/catalog-items/{item_id}, ETag: ""
    • 响应体: { "data": { "id": "uuid", "sku": "SKU-001", "name": "string", "status": "draft", "price": { "amount": 199.0, "currency": "CNY" }, "stock": 100, "created_at": "2025-01-01T10:00:00Z", "updated_at": "2025-01-01T10:00:00Z" } }
  • 可能的错误
    • 400(请求体格式错误)
    • 401/403
    • 409(SKU 已存在)
    • 422(字段校验失败)
  1. 全量更新商品目录条目(替换)
  • 路径与方法
    • PUT /api/v1/catalog-items/{item_id}
  • 语义
    • 使用请求体提供的资源表示替换现有资源的全部可写字段
  • 路径参数
    • item_id: string(UUID)
  • 请求头
    • Content-Type: application/json
    • Accept: application/json
    • Authorization: Bearer
    • If-Match: ""
  • 请求体(JSON,与创建类似,需提供完整可写字段) { "sku": "SKU-001", "name": "string", "description": "string", "category_id": "uuid", "status": "active", "price": { "amount": 199.0, "currency": "CNY" }, "stock": 120, "images": [], "attributes": {}, "dimensions": { "length": 10, "width": 5, "height": 2, "unit": "cm" }, "weight": { "value": 0.5, "unit": "kg" }, "tags": [], "seo": { "title": "string", "description": "string", "keywords": [] }, "variants": [] }
  • 成功响应(200)
    • 响应头:ETag: ""
    • 响应体: { "data": { "id": "uuid", "sku": "SKU-001", "name": "string", "status": "active", "price": { "amount": 199.0, "currency": "CNY" }, "stock": 120, "updated_at": "2025-01-02T10:00:00Z" } }
  • 可能的错误
    • 400/401/403/404
    • 409(SKU 冲突)
    • 412(ETag 不匹配)
    • 422(校验失败)
    • 428(缺少 If-Match)
  1. 部分更新商品目录条目
  • 路径与方法
    • PATCH /api/v1/catalog-items/{item_id}
  • 语义
    • 仅更新请求体中提供的字段(部分更新)
  • 路径参数
    • item_id: string(UUID)
  • 请求头
    • Content-Type: application/json
    • Accept: application/json
    • Authorization: Bearer
    • If-Match: ""
  • 请求体(JSON,提供需更新字段的子集) { "name": "new name", "status": "active", "price": { "amount": 209.0, "currency": "CNY" }, "stock": 150, "attributes": { "color": "blue" } }
  • 成功响应(200)
    • 响应头:ETag: ""
    • 响应体: { "data": { "id": "uuid", "sku": "SKU-001", "name": "new name", "status": "active", "price": { "amount": 209.0, "currency": "CNY" }, "stock": 150, "updated_at": "2025-01-03T10:00:00Z" } }
  • 可能的错误
    • 400/401/403/404
    • 409(SKU 冲突)
    • 412(ETag 不匹配)
    • 422(校验失败)
    • 428(缺少 If-Match)

示例过滤与排序用法

  • GET /api/v1/catalog-items?status=active&category_id=abc123&q=运动鞋&sort=-updated_at&fields=id,sku,name,price,status&page=1&per_page=20

示例错误响应

  • 409 冲突(SKU 已存在) { "error": { "code": "SKU_CONFLICT", "message": "SKU already exists", "details": { "sku": "SKU-001" }, "request_id": "req_123" } }

项目任务与子任务 RESTful API 设计

全局规范

  • Base URL: https://api.example.com/v1
  • 媒体类型:
    • 请求头: Content-Type: application/xml
    • 响应头: Content-Type: application/xml
    • 接受类型: Accept: application/xml
  • 认证要求: 公开(无认证)
  • 错误响应格式(示例):
    <error>
      <code>404</code>
      <type>not_found</type>
      <message>Resource not found</message>
    </error>
    

资源模型

  • Task(任务)

    <task>
      <id>123</id>
      <project_id>45</project_id>
      <title>Design API</title>
      <description>Define REST endpoints</description>
      <status>open</status> <!-- open | in_progress | completed | archived -->
      <priority>medium</priority> <!-- low | medium | high | urgent -->
      <assignee_id>789</assignee_id>
      <due_date>2025-12-31</due_date> <!-- YYYY-MM-DD -->
      <tags>
        <tag>api</tag>
        <tag>design</tag>
      </tags>
      <created_at>2025-11-24T10:00:00Z</created_at>
      <updated_at>2025-11-24T12:00:00Z</updated_at>
    </task>
    
  • Subtask(子任务)

    <subtask>
      <id>987</id>
      <task_id>123</task_id>
      <title>Write XML spec</title>
      <status>in_progress</status> <!-- open | in_progress | completed | archived -->
      <order>1</order>
      <due_date>2025-12-20</due_date>
      <created_at>2025-11-24T11:00:00Z</created_at>
      <updated_at>2025-11-24T12:30:00Z</updated_at>
    </subtask>
    
  • 列表响应分页元数据(集合响应中包含)

    <pagination>
      <page>1</page>
      <page_size>20</page_size>
      <total_items>135</total_items>
      <total_pages>7</total_pages>
    </pagination>
    

端点设计

任务(Tasks)

创建任务

  • URL: /tasks
  • 方法: POST
  • 认证: 公开(无认证)
  • 请求头:
    • Content-Type: application/xml
    • Accept: application/xml
  • 请求体(XML):
    <task>
      <project_id>45</project_id>
      <title>Design API</title>
      <description>Define REST endpoints</description>
      <status>open</status>
      <priority>medium</priority>
      <assignee_id>789</assignee_id>
      <due_date>2025-12-31</due_date>
      <tags>
        <tag>api</tag>
        <tag>design</tag>
      </tags>
    </task>
    
  • 响应:
    • 201 Created
      • 头: Location: /tasks/{id}
      • 体: 创建后的任务实体(XML)
    • 400/422 错误(XML)

列出任务(可筛选/分页)

  • URL: /tasks
  • 方法: GET
  • 认证: 公开(无认证)
  • 请求头:
    • Accept: application/xml
  • 查询参数(可选):
    • page: 整数,默认1
    • page_size: 整数,默认20,最大100
    • sort_by: title|due_date|priority|created_at|updated_at|status
    • order: asc|desc(默认asc)
    • status: open|in_progress|completed|archived
    • assignee_id: 整数
    • project_id: 整数
    • due_before: YYYY-MM-DD
    • due_after: YYYY-MM-DD
    • tag: 字符串(可重复出现)
  • 响应:
    • 200 OK
      • 体:
      <tasks_response>
        <tasks>
          <task>...</task>
          <task>...</task>
        </tasks>
        <pagination>
          <page>1</page>
          <page_size>20</page_size>
          <total_items>135</total_items>
          <total_pages>7</total_pages>
        </pagination>
      </tasks_response>
      
    • 400 错误(XML)

获取单个任务

  • URL: /tasks/{task_id}
  • 方法: GET
  • 认证: 公开(无认证)
  • 请求头:
    • Accept: application/xml
  • 路径参数:
    • task_id: 整数
  • 响应:
    • 200 OK(任务实体XML)
    • 404 Not Found(XML)

更新任务(整体替换)

  • URL: /tasks/{task_id}
  • 方法: PUT
  • 认证: 公开(无认证)
  • 请求头:
    • Content-Type: application/xml
    • Accept: application/xml
  • 路径参数:
    • task_id: 整数
  • 请求体(XML,需提供完整资源字段集的可更新部分):
    <task>
      <project_id>45</project_id>
      <title>Design API - v2</title>
      <description>Update definition</description>
      <status>in_progress</status>
      <priority>high</priority>
      <assignee_id>789</assignee_id>
      <due_date>2026-01-15</due_date>
      <tags>
        <tag>api</tag>
        <tag>update</tag>
      </tags>
    </task>
    
  • 响应:
    • 200 OK(更新后的任务实体XML)
    • 400/422 错误(XML)
    • 404 Not Found(XML)

删除任务

  • URL: /tasks/{task_id}
  • 方法: DELETE
  • 认证: 公开(无认证)
  • 路径参数:
    • task_id: 整数
  • 响应:
    • 204 No Content
    • 404 Not Found(XML)

项目范围内的任务(Project-scoped Tasks)

在项目下创建任务

  • URL: /projects/{project_id}/tasks
  • 方法: POST
  • 认证: 公开(无认证)
  • 请求头:
    • Content-Type: application/xml
    • Accept: application/xml
  • 路径参数:
    • project_id: 整数
  • 请求体(XML):
    <task>
      <title>Design API</title>
      <description>Define REST endpoints</description>
      <status>open</status>
      <priority>medium</priority>
      <assignee_id>789</assignee_id>
      <due_date>2025-12-31</due_date>
      <tags>
        <tag>api</tag>
      </tags>
    </task>
    
  • 响应:
    • 201 Created(Location: /tasks/{id},体为任务实体XML)
    • 404 Not Found(当 project_id 不存在)
    • 400/422 错误(XML)

列出项目下的任务

  • URL: /projects/{project_id}/tasks
  • 方法: GET
  • 认证: 公开(无认证)
  • 请求头:
    • Accept: application/xml
  • 路径参数:
    • project_id: 整数
  • 查询参数(可选):
    • page, page_size, sort_by, order, status, assignee_id, due_before, due_after, tag(同 /tasks)
  • 响应:
    • 200 OK(集合XML,结构同 /tasks 列表响应)
    • 404 Not Found(当 project_id 不存在)

子任务(Subtasks)

创建子任务

  • URL: /tasks/{task_id}/subtasks
  • 方法: POST
  • 认证: 公开(无认证)
  • 请求头:
    • Content-Type: application/xml
    • Accept: application/xml
  • 路径参数:
    • task_id: 整数
  • 请求体(XML):
    <subtask>
      <title>Write XML spec</title>
      <status>open</status>
      <order>1</order>
      <due_date>2025-12-20</due_date>
    </subtask>
    
  • 响应:
    • 201 Created(Location: /tasks/{task_id}/subtasks/{id},体为子任务实体XML)
    • 404 Not Found(当 task_id 不存在)
    • 400/422 错误(XML)

列出子任务

  • URL: /tasks/{task_id}/subtasks
  • 方法: GET
  • 认证: 公开(无认证)
  • 请求头:
    • Accept: application/xml
  • 路径参数:
    • task_id: 整数
  • 查询参数(可选):
    • page: 整数,默认1
    • page_size: 整数,默认20,最大100
    • sort_by: title|due_date|order|created_at|updated_at|status
    • order: asc|desc
    • status: open|in_progress|completed|archived
    • due_before: YYYY-MM-DD
    • due_after: YYYY-MM-DD
  • 响应:
    • 200 OK
      <subtasks_response>
        <subtasks>
          <subtask>...</subtask>
          <subtask>...</subtask>
        </subtasks>
        <pagination>
          <page>1</page>
          <page_size>20</page_size>
          <total_items>12</total_items>
          <total_pages>1</total_pages>
        </pagination>
      </subtasks_response>
      
    • 404 Not Found(当 task_id 不存在)

获取单个子任务

  • URL: /tasks/{task_id}/subtasks/{subtask_id}
  • 方法: GET
  • 认证: 公开(无认证)
  • 请求头:
    • Accept: application/xml
  • 路径参数:
    • task_id: 整数
    • subtask_id: 整数
  • 响应:
    • 200 OK(子任务实体XML)
    • 404 Not Found(XML)

更新子任务(整体替换)

  • URL: /tasks/{task_id}/subtasks/{subtask_id}
  • 方法: PUT
  • 认证: 公开(无认证)
  • 请求头:
    • Content-Type: application/xml
    • Accept: application/xml
  • 路径参数:
    • task_id: 整数
    • subtask_id: 整数
  • 请求体(XML):
    <subtask>
      <title>Write XML spec - revised</title>
      <status>in_progress</status>
      <order>2</order>
      <due_date>2025-12-22</due_date>
    </subtask>
    
  • 响应:
    • 200 OK(更新后的子任务实体XML)
    • 400/422 错误(XML)
    • 404 Not Found(XML)

删除子任务

  • URL: /tasks/{task_id}/subtasks/{subtask_id}
  • 方法: DELETE
  • 认证: 公开(无认证)
  • 路径参数:
    • task_id: 整数
    • subtask_id: 整数
  • 响应:
    • 204 No Content
    • 404 Not Found(XML)

示例详情

解决的问题

帮助开发者快速设计符合RESTful规范的API端点,使其能够高效规划URL结构、明确HTTP方法、定义数据请求与响应格式,同时涵盖访问权限的认证要求,简化开发流程并提升API设计质量。

适用用户

初创企业技术负责人

快速获取标准化API设计方案,加速产品开发周期,确保输出符合行业规范的技术产品。

后端开发工程师

通过自动生成的RESTful API设计,减少重复性脑力劳动,提高工作效率和专注度。

产品经理

无需技术背景,也能快速定义API需求,帮助团队实现精准开发对齐与明确分工。

特征总结

轻松生成符合RESTful规范的API端点设计方案,无需手动定义每个细节。
支持多种CRUD操作的自动化设计,包括创建、查询、更新、删除等常用功能。
快速规划API的URL模式与HTTP方法,确保业务场景中的使用逻辑清晰高效。
自动提供详细的请求与响应格式设计,助你优化数据交互体验。
灵活支持多层级访问权限设定,确保API的安全性与合规性。
高效适配不同类型的资源需求,从用户管理到电商库存皆可覆盖。
让开发与产品团队协作更高效,减少设计与沟通的反复耗时。
可定制化API端点模板,轻松满足个性化和行业化需求。
基于使用场景自动优化API结构,大幅度提升开发效率和可维护性。

如何使用购买的提示词模板

1. 直接在外部 Chat 应用中使用

将模板生成的提示词复制粘贴到您常用的 Chat 应用(如 ChatGPT、Claude 等),即可直接对话使用,无需额外开发。适合个人快速体验和轻量使用场景。

2. 发布为 API 接口调用

把提示词模板转化为 API,您的程序可任意修改模板参数,通过接口直接调用,轻松实现自动化与批量处理。适合开发者集成与业务系统嵌入。

3. 在 MCP Client 中配置使用

在 MCP client 中配置对应的 server 地址,让您的 AI 应用自动调用提示词模板。适合高级用户和团队协作,让提示词在不同 AI 工具间无缝衔接。

AI 提示词价格
¥25.00元
先用后买,用好了再付款,超安全!

您购买后可以获得什么

获得完整提示词模板
- 共 676 tokens
- 4 个可调节参数
{ 资源类型 } { 操作类型 } { 认证级别 } { 请求/响应格式 }
获得社区贡献内容的使用权
- 精选社区优质案例,助您快速上手提示词
使用提示词兑换券,低至 ¥ 9.9
了解兑换券 →
限时半价

不要错过!

半价获取高级提示词-优惠即将到期

17
:
23
小时
:
59
分钟
:
59