API 文档
快速开始
1. 获取API密钥
登录系统后,在项目管理页面创建或编辑项目;您既可以沿用旧服务器上的 API Key,也可以留空让系统自动生成。
2. 配置请求头
客户端检查更新推荐使用 X-API-Key; 管理接口请使用 Bearer Token 或后台 Session。
3. 调用接口
更新检查请尽量同时传入 architecture和 currentVersion,以命中“架构最新可用版本”逻辑。
代码示例
不同编程语言的集成示例
// 使用 API Key 检查 arm64-v8a 是否有更新
fetch('/api/v1/check', {
method: 'POST',
headers: {
'X-API-Key': 'your-project-api-key',
'Content-Type': 'application/json'
},
body: JSON.stringify({
currentVersion: '1.0.0',
architecture: 'arm64-v8a'
})
})
.then(r => r.json())
.then(console.log)API 端点
认证
GET
/api/user/token获取当前用户的API Token
认证方式: Session
响应示例
{
"token": "hot_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"createdAt": "2024-01-01T00:00:00.000Z"
}POST
/api/user/token生成或重新生成API Token
认证方式: Session
响应示例
{
"token": "hot_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"createdAt": "2024-01-01T00:00:00.000Z",
"message": "API Token已生成"
}版本检查
POST
/api/v1/check检查指定架构是否有更新(使用 API Key,推荐客户端调用)
认证方式: X-API-Key
请求头
{
"X-API-Key": "your-project-api-key"
}请求体
{
"currentVersion": "1.0.0",
"architecture": "arm64-v8a"
}响应示例
{
"success": true,
"hasUpdate": true,
"data": {
"version": "1.0.1",
"downloadUrl": "/api/version-artifacts/{artifactId}/download",
"md5": "0123456789abcdef0123456789abcdef",
"size": 123456,
"forceUpdate": false,
"changelog": "1. 修复热更新失败",
"createdAt": "2026-03-28T21:00:00.000Z",
"updatedAt": "2026-03-28T21:10:00.000Z",
"timestamp": 1774703400000,
"publishState": "READY",
"architectureKey": "arm64-v8a",
"architectureName": "ARM64",
"artifactId": "artifact_xxxxx"
}
}POST
/api/v1/check检查指定架构是否有更新(使用 Bearer Token)
认证方式: Bearer Token
请求头
{
"Authorization": "Bearer hot_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
}请求体
{
"projectId": "clxxxxx",
"currentVersion": "1.0.0",
"architecture": "arm64-v8a"
}响应示例
{
"success": true,
"hasUpdate": true,
"data": {
"version": "1.0.1",
"downloadUrl": "/api/version-artifacts/{artifactId}/download",
"md5": "0123456789abcdef0123456789abcdef",
"size": 123456,
"forceUpdate": false,
"changelog": "1. 修复热更新失败",
"createdAt": "2026-03-28T21:00:00.000Z",
"updatedAt": "2026-03-28T21:10:00.000Z",
"timestamp": 1774703400000,
"publishState": "READY",
"architectureKey": "arm64-v8a",
"architectureName": "ARM64",
"artifactId": "artifact_xxxxx"
}
}GET
/api/v1/check?projectId={projectId}&architecture=arm64-v8a获取指定架构的最新可用版本(使用 Bearer Token)
认证方式: Bearer Token
请求头
{
"Authorization": "Bearer hot_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
}请求体
// GET 请求,projectId / architecture 通过 URL 参数传递响应示例
{
"success": true,
"data": {
"version": "1.0.3",
"downloadUrl": "/api/version-artifacts/{artifactId}/download",
"md5": "0123456789abcdef0123456789abcdef",
"size": 123456,
"forceUpdate": false,
"changelog": "1. 修复热更新失败",
"createdAt": "2026-03-28T21:00:00.000Z",
"updatedAt": "2026-03-28T21:10:00.000Z",
"timestamp": 1774703400000,
"publishState": "READY",
"architectureKey": "arm64-v8a",
"architectureName": "ARM64",
"artifactId": "artifact_xxxxx"
}
}POST
/api/versions/latest获取指定架构的最新可用版本(使用 API Key,兼容旧客户端)
认证方式: X-API-Key
请求头
{
"X-API-Key": "your-project-api-key"
}请求体
{
"currentVersion": "1.0.0",
"architecture": "arm64-v8a"
}响应示例
{
"success": true,
"hasUpdate": true,
"data": {
"version": "1.0.1",
"downloadUrl": "/api/version-artifacts/{artifactId}/download",
"md5": "0123456789abcdef0123456789abcdef",
"size": 123456,
"forceUpdate": false,
"changelog": "1. 修复热更新失败",
"createdAt": "2026-03-28T21:00:00.000Z",
"updatedAt": "2026-03-28T21:10:00.000Z",
"timestamp": 1774703400000,
"isCurrent": true,
"publishState": "READY",
"architectureKey": "arm64-v8a",
"architectureName": "ARM64",
"artifactId": "artifact_xxxxx"
}
}POST
/api/versions/latest获取指定架构的最新可用版本(使用 Bearer Token)
认证方式: Bearer Token
请求头
{
"Authorization": "Bearer hot_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
}请求体
{
"projectId": "clxxxxx",
"architecture": "arm64-v8a",
"currentVersion": "1.0.0"
}响应示例
{
"success": true,
"hasUpdate": true,
"data": {
"version": "1.0.1",
"downloadUrl": "/api/version-artifacts/{artifactId}/download",
"md5": "0123456789abcdef0123456789abcdef",
"size": 123456,
"forceUpdate": false,
"changelog": "1. 修复热更新失败",
"createdAt": "2026-03-28T21:00:00.000Z",
"updatedAt": "2026-03-28T21:10:00.000Z",
"timestamp": 1774703400000,
"isCurrent": true,
"publishState": "READY",
"architectureKey": "arm64-v8a",
"architectureName": "ARM64",
"artifactId": "artifact_xxxxx"
}
}GET
/api/version-artifacts/{artifactId}/download按产物 ID 下载主程序或附件
认证方式: 公开(由服务端重定向或代理)
响应示例
302 Redirect
Location: https://storage.example.com/project/artifact.apk项目管理
版本管理
安全说明
• API密钥应妥善保管,避免泄露到公开代码库中
• 建议在服务端调用API,避免在客户端直接暴露密钥
• 定期更新API密钥以确保安全性
• 所有API请求都通过HTTPS加密传输