GET /api/v1/health

健康检查

检查 API 服务运行状态,无需认证

响应示例

200 OK
{
  "status": "ok",
  "service": "ybw-gpu-quotation-api",
  "version": "1.2.0",
  "https": true,
  "features": ["request_logging", "admin_api", "ssl_tls"]
}

cURL 示例

cURL
curl -X GET "https://ybw.api.ccoe.vip/api/v1/health"

Python 示例

Python
import requests

response = requests.get("https://ybw.api.ccoe.vip/api/v1/health")
print(response.json())
POST /api/v1/quotation/upload

上传设备清单

上传 GPU 设备清单 Excel 文件,系统将自动生成维保报价。支持本地文件上传或远程 URL 下载。

请求头

参数类型必需描述
AuthorizationstringBearer test-token-123

请求参数

方式一:本地文件上传 (multipart/form-data)

参数类型必需描述
filefileExcel 文件 (.xlsx/.xls)

方式二:远程 URL 下载 (application/json)

参数类型必需描述
file_urlstringExcel 文件的 HTTP/HTTPS 链接

cURL 示例

上传本地文件
curl -X POST "https://ybw.api.ccoe.vip/api/v1/quotation/upload" \
  -H "Authorization: Bearer test-token-123" \
  -F "file=@device-list.xlsx"
通过 URL 下载
curl -X POST "https://ybw.api.ccoe.vip/api/v1/quotation/upload" \
  -H "Authorization: Bearer test-token-123" \
  -H "Content-Type: application/json" \
  -d '{"file_url": "https://example.com/device-list.xlsx"}'

Python 示例

Python
import requests

BASE_URL = "https://ybw.api.ccoe.vip"
HEADERS = {"Authorization": "Bearer test-token-123"}

# 方式一:上传本地文件
with open("device-list.xlsx", "rb") as f:
    files = {"file": f}
    response = requests.post(
        f"{BASE_URL}/api/v1/quotation/upload",
        headers=HEADERS,
        files=files
    )
    result = response.json()
    print(f"任务ID: {result['data']['request_id']}")
    print(f"状态: {result['data']['status']}")

# 方式二:通过 URL 下载
data = {"file_url": "https://example.com/device-list.xlsx"}
response = requests.post(
    f"{BASE_URL}/api/v1/quotation/upload",
    headers=HEADERS,
    json=data
)

响应示例

202 Accepted
{
  "success": true,
  "message": "文件上传成功,正在处理...",
  "data": {
    "request_id": "req_abc123xyz",
    "status": "pending",
    "check_url": "/api/v1/quotation/status/req_abc123xyz"
  }
}
GET /api/v1/quotation/status/{request_id}

查询任务状态

查询报价任务的当前状态和结果

路径参数

参数类型必需描述
request_idstring任务ID

cURL 示例

cURL
curl -X GET "https://ybw.api.ccoe.vip/api/v1/quotation/status/req_abc123xyz" \
  -H "Authorization: Bearer test-token-123"

Python 示例

Python
import requests

BASE_URL = "https://ybw.api.ccoe.vip"
HEADERS = {"Authorization": "Bearer test-token-123"}

request_id = "req_abc123xyz"
response = requests.get(
    f"{BASE_URL}/api/v1/quotation/status/{request_id}",
    headers=HEADERS
)
result = response.json()

if result['data']['status'] == 'completed':
    files = result['data']['result']['files']
    print(f"内部版: {files['internal']['download_url']}")
    print(f"客户版: {files['customer']['download_url']}")
GET /api/v1/quotation/download/{file_id}

下载报价文件

下载生成的报价 Excel 文件

cURL 示例

cURL
curl -X GET "https://ybw.api.ccoe.vip/api/v1/quotation/download/file_abc123" \
  -H "Authorization: Bearer test-token-123" \
  -o "报价单.xlsx"

Python 示例

Python
import requests

BASE_URL = "https://ybw.api.ccoe.vip"
HEADERS = {"Authorization": "Bearer test-token-123"}

file_id = "file_abc123"
response = requests.get(
    f"{BASE_URL}/api/v1/quotation/download/{file_id}",
    headers=HEADERS
)

# 保存文件
with open("报价单.xlsx", "wb") as f:
    f.write(response.content)
GET /api/v1/admin/stats

系统统计信息(管理员)

查看系统运行统计信息,需要管理员 Token

cURL 示例

cURL
curl -X GET "https://ybw.api.ccoe.vip/api/v1/admin/stats" \
  -H "Authorization: Bearer admin-secret-token-456"

响应示例

200 OK
{
  "success": true,
  "data": {
    "total": 150,
    "pending": 5,
    "processing": 3,
    "completed": 140,
    "failed": 2,
    "today": 15,
    "active_tasks": 8,
    "system_status": "running",
    "timestamp": "2026-03-01T12:00:00Z"
  }
}