设备
复制包含安装步骤和该插件完整 Markdown 指南的配置 prompt。
设备是向 Capgo 报告更新器元数据的单个应用安装实例。使用此 API 可获取该元数据,或设置和移除特定于设备的私有通道覆盖。
设备元数据
“设备元数据”章节每条记录可包含设备 ID、平台、updater 和操作系统版本、Native Build、已安装的 bundle、生产环境与模拟器状态、自定义 ID 以及通道覆盖项。
可用时, country_code 是从由 Cloudflare 处理的、针对该设备的请求中收到的最新有效两位 ISO 3166-1 国家 code。它不是 GPS,也不是您应用提供的位置值。它可以是 null 不可用时;需要此字段时,请使用单设备查询。
POST
标题为“POST”的章节https://api.capgo.app/device/
将设备专属覆盖设置为 私有 通道。要为设备选择 bundle,请将该 bundle 分配给该通道;不支持直接按设备覆盖 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/公共频道不能用作设备覆盖。
成功响应
标题为“成功响应”的章节{ "status": "ok"}GET
“GET”章节https://api.capgo.app/device/
获取设备元数据。省略时,结果按游标分页。 device_id.
查询参数
标题为“查询参数”的部分app_id: 必填,反向域名格式的 App ID,例如com.example.app.device_id: 可选设备 ID。提供后,响应为单个设备,而非分页列表。customIdMode: 可选布尔值。设置为true以仅返回具有非空custom_id.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包含应用和设备 ID 的 endpoint。
从设备继续
“从 Devices 继续”部分如果你正在使用 设备 要规划 Channel 路由和分阶段发布,请将其与 通道 有关 Channels 的实现细节, 通道 有关 Channels 的实现细节, 通道 有关 Channels 的实现细节, Beta 测试解决方案 适用于 Beta Testing Solution 产品工作流的,以及 版本定向解决方案 适用于 Version Targeting Solution 产品工作流的。