API 參考

rpicx 公開 API 文件

基礎資訊

默認地址https://api.rpicx.com/v1
資料格式JSON
OpenAPIGET /openapi.json

端点列表

GET /v1/health

認證:

功能:服務健康檢查,返回當前圖片總數和運行狀態。

響應 200:

{
  "status": "ok",
  "image_count": 100000
}

GET /v1/random

認證:

功能:從記憶體索引中隨機選取一張圖片,返回 302 重定向。

查詢參數:

參數類型必填說明
categorystring按分類過濾

成功 (302):

Location: https://img.rpicx.com/xxx.webp

無圖片 (404):

{ "success": false, "error": "No images available" }

GET /v1/categories

認證:

功能:返回圖片總數。

響應 200:

{
  "total_images": 100000,
  "categories": []
}

GET /v1/stats

認證:無(IP 限流 10 QPS,響應緩存 3 小時)

功能:返回服務聚合統計資訊。

響應 200:

{
  "requests_total": 1000000,
  "requests_today": 5000,
  "avg_hour_requests": 200.0,
  "uv_today": 1200,
  "top_referer": [{ "name": "github.com", "count": 300 }],
  "top_ua": [{ "name": "Chrome", "count": 500 }],
  "status": { "code_200": 900000, "code_302": 50000, "code_404": 20, "code_429": 10, "code_500": 0 },
  "sync_count": 30
}

GET /metrics

認證:

功能:Prometheus 指標暴露端點(text/plain)。

GET /openapi.json

認證:

功能:返回 OpenAPI 3.0 規範文檔(JSON)。