POST公开接口

提交当前版本并检查更新

提交客户端当前版本,返回是否有更新、是否必须更新、里程碑约束与目标版本。 请求体须提交 current_version 与 current_comparable_version 中的至少一个: 仅提交 current_version 时依赖该版本已在服务端登记且配置了 comparable_version, 否则应改为(或同时)提交 current_comparable_version。详见 CheckVersionUpdateDto。

URL

/api/v1/public/{projectKey}/versions/check-update

鉴权方式

无需鉴权

请求参数

Path 参数

名称类型必填说明
projectKeystring项目主键 project_key(大小写不敏感)

Header 参数

名称类型必填说明
x-verhub-platformwindows | linux | macos | ios | android | web | others客户端平台声明,仅用于请求统计,不影响接口返回内容。 识别优先级:本请求头 > query 参数 `platform` > 请求体 `platform` 字段 > User-Agent 推断。 取值大小写不敏感,无法识别时统计为 OTHERS。 具体系统版本请用 `x-verhub-platform-version` 单独提交;若把版本混在本字段里 (如 `Windows 11`、`ubuntu 24.04`),服务端会拆开,平台与版本分别入库。 建议 SDK 显式声明本请求头:服务端调用的 User-Agent 往往不可靠。
x-verhub-platform-versionstring客户端系统版本明细,仅用于请求统计,不影响接口返回内容。 自由文本,如 `11`、`ubuntu 24.04`、`26`;超过 32 字符视为无效直接丢弃。 识别优先级:本请求头 > query 参数 `platform_version` > 请求体 `platform_version` 字段 > 从 `platform` 中拆出的版本 > User-Agent 推断。

请求体

{
  "current_version": "v1.20.326",
  "current_comparable_version": "1.20.326",
  "include_preview": false,
  "locale": "en-US"
}

响应示例

200 响应

{
  "should_update": false,
  "required": false,
  "reason_codes": [
    "string"
  ],
  "current_version": "string",
  "current_comparable_version": "string",
  "latest_version": {
    "id": "ver-001",
    "version": "1.0.0",
    "comparable_version": "1.0.0",
    "title": "首发版本",
    "content": "首个正式版本,支持版本发布与公告推送。",
    "download_url": "https://example.com/download/verhub-1.0.0.zip",
    "download_links": [
      {
        "url": "https://example.com/download/verhub-1.0.0.zip",
        "name": "Windows 包",
        "platform": "windows"
      }
    ],
    "forced": false,
    "is_latest": true,
    "is_preview": false,
    "is_milestone": true,
    "is_deprecated": false,
    "platform": "windows",
    "platforms": [
      "windows",
      "mac"
    ],
    "custom_data": {
      "channel": "stable"
    },
    "created_at": 1760000000,
    "published_at": 1760000000
  },
  "latest_preview_version": {
    "id": "ver-001",
    "version": "1.0.0",
    "comparable_version": "1.0.0",
    "title": "首发版本",
    "content": "首个正式版本,支持版本发布与公告推送。",
    "download_url": "https://example.com/download/verhub-1.0.0.zip",
    "download_links": [
      {
        "url": "https://example.com/download/verhub-1.0.0.zip",
        "name": "Windows 包",
        "platform": "windows"
      }
    ],
    "forced": false,
    "is_latest": true,
    "is_preview": false,
    "is_milestone": true,
    "is_deprecated": false,
    "platform": "windows",
    "platforms": [
      "windows",
      "mac"
    ],
    "custom_data": {
      "channel": "stable"
    },
    "created_at": 1760000000,
    "published_at": 1760000000
  },
  "target_version": {
    "id": "ver-001",
    "version": "1.0.0",
    "comparable_version": "1.0.0",
    "title": "首发版本",
    "content": "首个正式版本,支持版本发布与公告推送。",
    "download_url": "https://example.com/download/verhub-1.0.0.zip",
    "download_links": [
      {
        "url": "https://example.com/download/verhub-1.0.0.zip",
        "name": "Windows 包",
        "platform": "windows"
      }
    ],
    "forced": false,
    "is_latest": true,
    "is_preview": false,
    "is_milestone": true,
    "is_deprecated": false,
    "platform": "windows",
    "platforms": [
      "windows",
      "mac"
    ],
    "custom_data": {
      "channel": "stable"
    },
    "created_at": 1760000000,
    "published_at": 1760000000
  },
  "milestone": {
    "current": false,
    "latest": false,
    "target_is_milestone": false
  }
}
POST

Try It Out

请求 URL 预览

/api/v1/public/verhub/versions/check-update