设备
复制包含安装步骤和该插件完整 Markdown 指南的配置 prompt。
Device 指的是向 Capgo 上报 updater 元数据的单个 App 安装实例。你可以通过该 API 来获取这些元数据,或者设置及移除特定设备的 private-channel 覆盖配置。
每条记录可以包含设备 ID、平台、updater 和 OS 版本、Native Build、已安装的 bundle、生产环境与模拟器状态、自定义 ID 以及 channel override。
如果可用, country_code 是针对该设备从 Cloudflare 处理的请求中收到的最新的、有效的两位 ISO 3166-1 国家 code。它不是 GPS 或由您的应用提供的位置值。它可以是 null 若不可用;在需要此字段时,请使用单设备查询。
POST
标题为“POST”的章节https://api.capgo.app/device/
将设备特定的覆盖项设置为 private channel。若要为特定设备选择 bundle,请将该 bundle 分配给该 channel;暂不支持直接进行单设备 bundle 覆盖。除非再次执行 POST,否则覆盖将在最后一次写入 90 天后过期。
interface DeviceChannelOverride { app_id: string; // reverse-domain app ID, for example com.example.app device_id: string; channel: string; // existing non-public channel name}请求示例
标题为“请求示例”的章节curl -X POST \ -H "authorization: your-api-key" \ -H "Content-Type: application/json" \ -d '{ "app_id": "com.example.app", "device_id": "device_456", "channel": "beta" }' \ https://api.capgo.app/device/公共频道不能用作设备覆盖 (device overrides)。
成功响应
标题为“成功响应”的章节{ "status": "ok"}GET
“GET”章节https://api.capgo.app/device/
获取设备元数据。如果不提供 device_id.
查询参数 (Query parameters),结果将采用游标分页。
标题为“查询参数”的部分app_id:必填,反向域名格式的 App ID,例如com.example.app.device_id:可选的 device ID。如果提供,响应将返回单个设备而非分页列表。customIdMode:可选布尔值。设置为true以仅返回具有非空custom_id.cursor:可选,来自上一次列表响应的 cursor。limit:可选,每页显示的设备数量。
请求示例
标题为“请求示例”的章节# Get the first pagecurl -H "authorization: your-api-key" \ "https://api.capgo.app/device/?app_id=com.example.app"
# Get one device, including its request-derived country when availablecurl -H "authorization: your-api-key" \ "https://api.capgo.app/device/?app_id=com.example.app&device_id=device_456"
# Get only devices with a custom IDcurl -H "authorization: your-api-key" \ "https://api.capgo.app/device/?app_id=com.example.app&customIdMode=true"
# Get the next pagecurl -H "authorization: your-api-key" \ "https://api.capgo.app/device/?app_id=com.example.app&cursor=2024-01-01T00:00:00Z%7Cdevice_456"响应类型
标题为“响应类型”的章节interface DeviceListResponse { data: Device[]; nextCursor?: string; hasMore: boolean;}
interface Device { updated_at: string; device_id: string; custom_id: string; version?: number; version_name: string | null; channel?: string; app_id: string; platform: "ios" | "android" | "electron"; plugin_version: string; os_version: string; version_build: string; is_prod: boolean; is_emulator: boolean; key_id: string | null; install_source: string | null; country_code: string | null;}country_code 当 Capgo 存有由 Cloudflare 推导出的有效国家 code 时,会通过设备特定的查询填充。不含有效国家的请求不会清除上一个有效值;列表响应可能返回 null 该字段的值。
响应示例(列表)
标题为“响应示例(列表)”的章节{ "data": [ { "device_id": "device_456", "custom_id": "test-device-1", "version": 1, "version_name": "1.0.0", "app_id": "com.example.app", "platform": "ios", "plugin_version": "5.0.0", "os_version": "17.0", "version_build": "1", "is_prod": true, "is_emulator": false, "key_id": null, "install_source": null, "country_code": null, "updated_at": "2024-01-01T00:00:00Z" } ], "nextCursor": "2024-01-01T00:00:00Z|device_456", "hasMore": true}响应示例(单个设备)
标题为“响应示例(单个设备)”的章节{ "device_id": "device_456", "custom_id": "test-device-1", "version": 1, "version_name": "1.0.0", "app_id": "com.example.app", "platform": "ios", "plugin_version": "5.0.0", "os_version": "17.0", "version_build": "1", "is_prod": true, "is_emulator": false, "key_id": "MIIB", "install_source": null, "country_code": "FR", "updated_at": "2024-01-01T00:00:00Z", "channel": "beta"}https://api.capgo.app/device/
移除设备的 channel override。设备将重新使用正常的 channel 选择逻辑;此 endpoint 不会删除其元数据记录。
请求体或查询参数
标题为“请求体或查询参数”的章节interface DeviceOverrideRemoval { app_id: string; device_id: string;}请求示例
标题为“请求示例”的章节curl -X DELETE \ -H "authorization: your-api-key" \ -H "Content-Type: application/json" \ -d '{ "app_id": "com.example.app", "device_id": "device_456" }' \ https://api.capgo.app/device/成功响应
标题为“成功响应”的章节{ "status": "ok"}错误会返回 HTTP 状态码及包含以下 error 以及 message 字段的 JSON 响应体。常见的错误码包括:
invalid_app_id何时app_id不是有效的反向域名标识符。device_not_found无法查询到该未知设备。channel_not_found请求的 channel 不存在。public_channel_override尝试将设备覆盖到公共 channel 时出错。invalid_version_id尝试直接覆盖 bundle 时出错;请改用 channel。cannot_access_app或cannot_access_channel当 API 密钥缺少必要权限时。
常见使用场景
“常见用例”章节-
将测试设备移至私有 Beta 测试频道
{"app_id": "com.example.app","device_id": "device_456","channel": "beta"} -
将设备重置为常规频道选择
使用
DELETE包含 App ID 和设备 ID 的端点。
继续阅读“设备”相关内容
“继续阅读“设备”相关内容”章节如果你正在使用 设备 要规划 Channel 路由和分阶段发布,请将其与 通道 有关 Channels 的实现细节, 通道 有关 Channels 的实现细节, 通道 有关 Channels 的实现细节, Beta 测试解决方案 适用于 Beta Testing Solution 产品工作流的,以及 版本定向解决方案 适用于 Version Targeting Solution 产品工作流的。