项目信息

获取 OpenAPI 文档

GET/openapi.json
公开访问

访问类别:匿名 API,可携带 Token 使用独立额度

响应

200 OpenAPI 3.1 文档

application/json

{
  "type": "object",
  "properties": {
    "openapi": {
      "type": "string"
    },
    "info": {
      "type": "object",
      "properties": {
        "title": {
          "type": "string"
        },
        "version": {
          "type": "string"
        }
      },
      "required": [
        "title",
        "version"
      ],
      "additionalProperties": {}
    },
    "paths": {
      "type": "object",
      "additionalProperties": {}
    }
  },
  "required": [
    "openapi",
    "info",
    "paths"
  ],
  "additionalProperties": {}
}
400 参数或请求格式无效

application/json

{
  "type": "object",
  "properties": {
    "error": {
      "type": "object",
      "properties": {
        "code": {
          "type": "string"
        },
        "message": {
          "type": "string"
        },
        "issues": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "location": {
                "type": "string",
                "enum": [
                  "body",
                  "query",
                  "path",
                  "header"
                ]
              },
              "field": {
                "type": "string"
              },
              "code": {
                "type": "string"
              },
              "message": {
                "type": "string"
              }
            },
            "required": [
              "location",
              "field",
              "code",
              "message"
            ]
          }
        }
      },
      "required": [
        "code",
        "message"
      ]
    }
  },
  "required": [
    "error"
  ]
}
401 凭据无效、停用、过期或缺少所需 Token

application/json

{
  "type": "object",
  "properties": {
    "error": {
      "type": "object",
      "properties": {
        "code": {
          "type": "string"
        },
        "message": {
          "type": "string"
        },
        "issues": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "location": {
                "type": "string",
                "enum": [
                  "body",
                  "query",
                  "path",
                  "header"
                ]
              },
              "field": {
                "type": "string"
              },
              "code": {
                "type": "string"
              },
              "message": {
                "type": "string"
              }
            },
            "required": [
              "location",
              "field",
              "code",
              "message"
            ]
          }
        }
      },
      "required": [
        "code",
        "message"
      ]
    }
  },
  "required": [
    "error"
  ]
}
403 需要管理员 Token

application/json

{
  "type": "object",
  "properties": {
    "error": {
      "type": "object",
      "properties": {
        "code": {
          "type": "string"
        },
        "message": {
          "type": "string"
        },
        "issues": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "location": {
                "type": "string",
                "enum": [
                  "body",
                  "query",
                  "path",
                  "header"
                ]
              },
              "field": {
                "type": "string"
              },
              "code": {
                "type": "string"
              },
              "message": {
                "type": "string"
              }
            },
            "required": [
              "location",
              "field",
              "code",
              "message"
            ]
          }
        }
      },
      "required": [
        "code",
        "message"
      ]
    }
  },
  "required": [
    "error"
  ]
}
413 请求体过大

application/json

{
  "type": "object",
  "properties": {
    "error": {
      "type": "object",
      "properties": {
        "code": {
          "type": "string"
        },
        "message": {
          "type": "string"
        },
        "issues": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "location": {
                "type": "string",
                "enum": [
                  "body",
                  "query",
                  "path",
                  "header"
                ]
              },
              "field": {
                "type": "string"
              },
              "code": {
                "type": "string"
              },
              "message": {
                "type": "string"
              }
            },
            "required": [
              "location",
              "field",
              "code",
              "message"
            ]
          }
        }
      },
      "required": [
        "code",
        "message"
      ]
    }
  },
  "required": [
    "error"
  ]
}
415 请求内容类型无效

application/json

{
  "type": "object",
  "properties": {
    "error": {
      "type": "object",
      "properties": {
        "code": {
          "type": "string"
        },
        "message": {
          "type": "string"
        },
        "issues": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "location": {
                "type": "string",
                "enum": [
                  "body",
                  "query",
                  "path",
                  "header"
                ]
              },
              "field": {
                "type": "string"
              },
              "code": {
                "type": "string"
              },
              "message": {
                "type": "string"
              }
            },
            "required": [
              "location",
              "field",
              "code",
              "message"
            ]
          }
        }
      },
      "required": [
        "code",
        "message"
      ]
    }
  },
  "required": [
    "error"
  ]
}
429 请求过于频繁,Retry-After 为建议等待秒数;匿名额度及认证保护在各 Cloudflare 地点近似计数,Token 业务额度使用 D1 原子计数

application/json

{
  "type": "object",
  "properties": {
    "error": {
      "type": "object",
      "properties": {
        "code": {
          "type": "string"
        },
        "message": {
          "type": "string"
        },
        "issues": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "location": {
                "type": "string",
                "enum": [
                  "body",
                  "query",
                  "path",
                  "header"
                ]
              },
              "field": {
                "type": "string"
              },
              "code": {
                "type": "string"
              },
              "message": {
                "type": "string"
              }
            },
            "required": [
              "location",
              "field",
              "code",
              "message"
            ]
          }
        }
      },
      "required": [
        "code",
        "message"
      ]
    }
  },
  "required": [
    "error"
  ]
}
500 内部执行失败

application/json

{
  "type": "object",
  "properties": {
    "error": {
      "type": "object",
      "properties": {
        "code": {
          "type": "string"
        },
        "message": {
          "type": "string"
        },
        "issues": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "location": {
                "type": "string",
                "enum": [
                  "body",
                  "query",
                  "path",
                  "header"
                ]
              },
              "field": {
                "type": "string"
              },
              "code": {
                "type": "string"
              },
              "message": {
                "type": "string"
              }
            },
            "required": [
              "location",
              "field",
              "code",
              "message"
            ]
          }
        }
      },
      "required": [
        "code",
        "message"
      ]
    }
  },
  "required": [
    "error"
  ]
}

响应示例

运行命令前,将环境变量 BASE_URL 设置为站点地址。

成功响应

curl --silent --show-error -H 'User-Agent: simpleWebUtils-example/2.2.0' -H 'Accept: application/json' "$BASE_URL"'/openapi.json'
HTTP 200
content-type: application/json
content-encoding: gzip
cache-control: no-store

{
  "openapi": "3.1.0",
  "info": {
    "title": "oh! IT",
    "version": "2.2.0+git.6f9093533f24",
    "description": "HTTP 工具 API。命令行表示适用于带 curl 或 curl* 标记的接口。协商顺序为 _format、Accept、默认格式。Accept 支持 application/json、text/plain 和 image/svg+xml,按 q 值从高到低选择,相同值按出现顺序选择。curl* 接口默认 SVG;curl 接口在 curl、wget 或 HTTPie 中默认 text,其他客户端默认 JSON。_format 接受 json、text,plain 是 text 的别名;curl* 接口和 /color/{hex} 还支持 svg,/color/{hex} 的默认格式保持 JSON。其他接口收到 _format=svg 或 Accept: image/svg+xml 时返回 JSON。未识别的 _format 值继续按 Accept 协商。text 默认带 ANSI 颜色,_color=0、false、off、no 关闭颜色,其他值保持颜色。GET /badge 的 color 用于徽章颜色,_color 独立控制 ANSI。这些响应带 Vary: Accept。 倒计时公开缓存 60 秒,其余由输入决定的图形缓存 1 天。接口访问类别和 Bearer 认证要求见各操作说明。短链接与 Pastebin 的创建和管理要求 Token,分享地址允许匿名访问。业务接口支持跨域无凭据调用,并可提供 Authorization Token。匿名请求按 IP 使用每分钟约 120 次普通额度、30 次网络额度和 10 次计算额度;Token 请求按身份使用 D1 原子计数,普通额度独立配置,资源额度分别为 30 和 10。认证查询另有来源保护。鉴权及普通额度检查先于缓存,缓存未命中时检查资源额度。Minecraft 玩家与图片缓存 300 秒、服务端状态缓存 30 秒、种子结果缓存 3600 秒;RDAP 成功结果缓存 300 秒,引导文件缓存 24 小时;Bing 缓存最长 300 秒并受快照有效期约束。受限接口、分享内容、错误和敏感输入响应使用 no-store。POST /pastes 请求体最多 512 KiB,文本最多 65536 个 UTF-8 字节;其他接口请求体最多 65536 字节。限流返回 429、RATE_LIMITED 和 Retry-After。响应 X-Request-Id 可关联 Worker 日志。OPTIONS、静态资源和匿名连通性探测保留原有用途。",
    "license": {
      "name": "MIT",
      "url": "https://opensource.org/license/mit"
    }
  },
  "paths": {
    "/api.json": {
      "get": {
        "tags": [
          "项目信息"
        ],
        "summary": "列出可用接口",
        "responses": {
          "200": {
            "description": "项目及接口目录",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "name": {
                      "type": "string"
                    },
                    "version": {
                      "type": "string"
                    },
                    "build": {
                      "type": "object",
                      "properties": {
                        "version": {
                          "type": "string",
                          "description": "基础版本加 Git 构建元数据,符合 SemVer"
                        },
                        "gitHash": {
                          "type": "string",
                          "pattern": "^(?:[0-9a-f]{40}|[0-9a-f]{64})$"
                        },
                        "buildTime": {
                          "type": "string",
                          "format": "date-time",
                          "description": "构建开始时间,UTC ISO 8601"
                        }
                      },
                      "required": [
                        "version",
                        "gitHash",
                        "buildTime"
                      ]
                    },
                    "openapi": {
                      "type": "string"
                    },
                    "docs": {
                      "type": "string"
                    },
                    "endpoints": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "method": {
                            "type": "string"
                          },
                          "path": {
                            "type": "string"
                          },
                          "description": {
                            "type": "string"
                          },
                          "category": {
            
… 已截断,完整响应 565921 字符

错误示例

curl --silent --show-error -X PATCH -H 'User-Agent: simpleWebUtils-example/2.0.1' -H 'Accept: application/json' "$BASE_URL"'/openapi.json'
HTTP 405
content-type: application/json
content-encoding: gzip
cache-control: no-store

{
  "error": {
    "code": "METHOD_NOT_ALLOWED",
    "message": "接口不支持该请求方法"
  }
}

在线调试

Ctrl / ⌘ + Enter
调用示例
curl -X GET 'https://oit.sh/openapi.json'

响应

等待请求

等待发送请求

配置上方请求参数后点击「发送请求」查看实时响应

快捷键:Ctrl / ⌘ + Enter