GDSTJUV.CN APP远程升级API提供了完整的应用版本管理和更新检查功能,支持Android、iOS、Windows等多个平台。
https://gdstjuv.cn/api/v1/update/
所有API请求都需要提供有效的API密钥进行认证。
在请求中包含 api_key 参数:
{
"api_key": "your_api_key_here",
"package_name": "com.example.app",
...
}
/api/v1/update/check.php
| 参数名 | 类型 | 必填 | 说明 |
|---|---|---|---|
api_key |
string | 必填 | API密钥 |
package_name |
string | 必填 | 应用包名 |
platform |
string | 必填 | 平台(android/ios/windows等) |
current_version_code |
integer | 必填 | 当前版本代码 |
device_id |
string | 可选 | 设备唯一标识 |
channel |
string | 可选 | 更新渠道(stable/beta),默认stable |
{
"api_key": "your_api_key",
"package_name": "com.example.app",
"platform": "android",
"current_version_code": 100,
"device_id": "unique_device_id",
"channel": "stable"
}
{
"code": 200,
"message": "有可用更新",
"data": {
"has_update": true,
"version_name": "2.0.0",
"version_code": 200,
"title": "重大更新",
"description": "修复已知问题,新增功能...",
"changelog": "# 更新内容\n- 新增...\n- 修复...",
"file_size": 15728640,
"file_md5": "abc123...",
"file_sha256": "def456...",
"download_url": "https://gdstjuv.cn/api/v1/update/download.php?id=123",
"force_update": false,
"is_beta": false,
"released_at": "2024-12-27 10:00:00"
}
}
{
"code": 200,
"message": "已是最新版本",
"data": {
"has_update": false,
"current_version": "2.0.0"
}
}
/api/v1/update/download.php?id={version_id}&api_key={api_key}
| 参数名 | 类型 | 必填 | 说明 |
|---|---|---|---|
id |
integer | 必填 | 版本ID |
api_key |
string | 必填 | API密钥 |
直接返回文件流(二进制数据),支持断点续传。
Content-Type: application/octet-stream
Content-Disposition: attachment; filename="app_v2.0.0.apk"
Content-Length: 15728640
Content-MD5: YWJjMTIz...
X-Version-Name: 2.0.0
X-Version-Code: 200
/api/v1/update/log.php
| 参数名 | 类型 | 必填 | 说明 |
|---|---|---|---|
api_key |
string | 必填 | API密钥 |
version_id |
integer | 必填 | 版本ID |
update_status |
string | 必填 | 更新状态(success/failed/downloading) |
device_id |
string | 可选 | 设备ID |
old_version_code |
integer | 可选 | 旧版本代码 |
new_version_code |
integer | 可选 | 新版本代码 |
error_message |
string | 可选 | 错误信息 |
{
"api_key": "your_api_key",
"version_id": 123,
"device_id": "unique_device_id",
"old_version_code": 100,
"new_version_code": 200,
"update_status": "success"
}
| 错误码 | 说明 |
|---|---|
| 200 | 成功 |
| 400 | 请求参数错误 |
| 401 | 认证失败(API密钥无效) |
| 404 | 资源不存在 |
| 405 | 请求方法不允许 |
| 500 | 服务器内部错误 |
我们提供了各平台的SDK以简化集成:
// 检查更新
JSONObject params = new JSONObject();
params.put("api_key", "your_api_key");
params.put("package_name", getPackageName());
params.put("platform", "android");
params.put("current_version_code", BuildConfig.VERSION_CODE);
// 发送POST请求
// ...
import requests
# 检查更新
response = requests.post(
'https://gdstjuv.cn/api/v1/update/check.php',
json={
'api_key': 'your_api_key',
'package_name': 'com.example.app',
'platform': 'android',
'current_version_code': 100
}
)
data = response.json()
if data['data']['has_update']:
print('有新版本:', data['data']['version_name'])