SnipHunter API

Upload

媒体和文件上传。

Base URL https://api.sniphunter.com

OpenAPI JSON · 完整 Markdown

请求与响应中的 $ref 在 OpenAPI 的 components 中定义。

2 个接口

Upload

POST/api/v1/upload/minioUpload To Minio

代理上传到对象存储(默认 TOS),返回可下载 URL。 路径名 `/minio` 为历史兼容;直传失败时 Web 会降级到此接口。

{
  "requestBody": {
    "content": {
      "multipart/form-data": {
        "schema": {
          "$ref": "#/components/schemas/Body_upload_to_minio_api_v1_upload_minio_post"
        }
      }
    },
    "required": true
  },
  "responses": {
    "200": {
      "description": "Successful Response",
      "content": {
        "application/json": {
          "schema": {}
        }
      }
    },
    "422": {
      "description": "Validation Error",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/HTTPValidationError"
          }
        }
      }
    }
  }
}
POST/api/v1/upload/presignPresign Upload

签发对象存储直传凭证。 - mode=put:返回 upload_url,客户端 PUT 原始 body - mode=proxy:本地盘或不支持时,客户端应走 /upload/minio 允许匿名(与 /minio 一致,供工具输入)。

{
  "requestBody": {
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/PresignRequest"
        }
      }
    },
    "required": true
  },
  "responses": {
    "200": {
      "description": "Successful Response",
      "content": {
        "application/json": {
          "schema": {}
        }
      }
    },
    "422": {
      "description": "Validation Error",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/HTTPValidationError"
          }
        }
      }
    }
  }
}

数据模型

展开 components
{
  "schemas": {
    "Body_upload_to_minio_api_v1_upload_minio_post": {
      "properties": {
        "file": {
          "type": "string",
          "format": "binary",
          "title": "File",
          "description": "待上传的文件"
        },
        "folder": {
          "type": "string",
          "title": "Folder",
          "description": "存储子目录",
          "default": "uploads"
        }
      },
      "type": "object",
      "required": [
        "file"
      ],
      "title": "Body_upload_to_minio_api_v1_upload_minio_post"
    },
    "HTTPValidationError": {
      "properties": {
        "detail": {
          "items": {
            "$ref": "#/components/schemas/ValidationError"
          },
          "type": "array",
          "title": "Detail"
        }
      },
      "type": "object",
      "title": "HTTPValidationError"
    },
    "PresignRequest": {
      "properties": {
        "filename": {
          "type": "string",
          "title": "Filename",
          "description": "原始文件名(用于扩展名)"
        },
        "content_type": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Content Type",
          "description": "MIME 类型"
        },
        "size": {
          "anyOf": [
            {
              "type": "integer",
              "minimum": 1.0
            },
            {
              "type": "null"
            }
          ],
          "title": "Size",
          "description": "声明的字节大小"
        },
        "folder": {
          "type": "string",
          "title": "Folder",
          "description": "对象前缀目录",
          "default": "uploads"
        },
        "mode": {
          "type": "string",
          "title": "Mode",
          "description": "put | post(Web 用 put)",
          "default": "put"
        }
      },
      "type": "object",
      "required": [
        "filename"
      ],
      "title": "PresignRequest"
    },
    "ValidationError": {
      "properties": {
        "loc": {
          "items": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "integer"
              }
            ]
          },
          "type": "array",
          "title": "Location"
        },
        "msg": {
          "type": "string",
          "title": "Message"
        },
        "type": {
          "type": "string",
          "title": "Error Type"
        }
      },
      "type": "object",
      "required": [
        "loc",
        "msg",
        "type"
      ],
      "title": "ValidationError"
    }
  },
  "securitySchemes": {
    "HTTPBearer": {
      "type": "http",
      "scheme": "bearer"
    }
  }
}