设备
复制一个包含安装步骤和本插件的完整Markdown指南的设置提示。
设备代表了您应用的单独安装,且由 Capgo 管理。设备 API 允许您跟踪和管理设备,包括它们的包(版本)、频道和更新状态。
设备未连接到 __CAPGO_KEEP_0__ 内的此期间将被自动从系统中移除。活跃设备将持续被跟踪,因为它们检查更新。
了解设备设备每个设备都有独特的特征和状态:
- 平台: iOS, Android 或 Electron
- 打包 (版本): 当前打包 (版本) 和原生构建版本
- 环境: 生产或开发, 模拟器或物理设备
- 频道: 当前更新频道分配
- 自定义 ID: 供您自己的跟踪目的而设定的可选标识符
最佳实践
标题为“最佳实践”的部分- 版本跟踪: 监控设备版本更新以确保更新率
- 渠道管理: 根据测试需求将设备分配到适当的渠道
- 环境感知: 根据环境(prod/dev/emulator)进行适当处理
- 自定义识别: 使用自定义 ID 与您的现有系统进行集成
端点
端点POST
POSThttps://api.capgo.app/device/
连接设备到特定的包(版本)或频道中。
请求体
标题:请求体interface DeviceLink { app_id: string device_id: string version_id?: string // bundle (version) name channel?: string // channel name}示例请求
标题:示例请求curl -X POST \ -H "authorization: your-api-key" \ -H "Content-Type: application/json" \ -d '{ "app_id": "app_123", "device_id": "device_456", "channel": "beta" }' \ https://api.capgo.app/device/成功响应
标题:成功响应{ "status": "ok"}https://api.capgo.app/device/
获取设备信息。使用基于游标的分页来高效地检索大型设备列表。
Query Parameters
Section titled “Query Parameters”app_id: 必填项。您的应用程序 IDdevice_id: 可选项。要检索单个设备的特定设备 IDcursor: 可选项。从前一次响应中获取的游标limit: 可选项。每页显示的设备数量(默认值:50)
Example Requests
Section titled “Example Requests”# Get all devices (first page)curl -H "authorization: your-api-key" \ "https://api.capgo.app/device/?app_id=app_123"
# Get specific devicecurl -H "authorization: your-api-key" \ "https://api.capgo.app/device/?app_id=app_123&device_id=device_456"
# Get next page using cursorcurl -H "authorization: your-api-key" \ "https://api.capgo.app/device/?app_id=app_123&cursor=2024-01-01T00:00:00Z|device_456"响应类型(列表)
响应类型(列表)标题请求多个设备(无参数): device_id 复制到剪贴板
interface DeviceListResponse { data: Device[]; nextCursor?: string; // Pass this as 'cursor' param to get next page hasMore: boolean; // true if more pages available}
interface Device { updated_at: string; device_id: string; custom_id: string; version?: number; // bundle (version) id version_name: string | null; // bundle (version) name 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; // First 4 chars of encryption key (e.g., "MIIB")}响应类型(单个设备)标题
请求特定设备时(带参数),直接返回设备对象:复制到剪贴板 device_id 示例响应(列表)
interface Device { updated_at: string; device_id: string; custom_id: string; version?: number; // bundle (version) id version_name: string | null; // bundle (version) name 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; // First 4 chars of encryption key (e.g., "MIIB")}__CAPGO_KEEP_0__
__CAPGO_KEEP_0__{ "data": [ { "device_id": "device_456", "custom_id": "test-device-1", "version": 1, "version_name": "1.0.0", "app_id": "app_123", "platform": "ios", "plugin_version": "5.0.0", "os_version": "17.0", "version_build": "1", "is_prod": true, "is_emulator": false, "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": "app_123", "platform": "ios", "plugin_version": "5.0.0", "os_version": "17.0", "version_build": "1", "is_prod": true, "is_emulator": false, "updated_at": "2024-01-01T00:00:00Z", "channel": "production"}删除
删除https://api.capgo.app/device/
从其通道重写中解除设备的绑定。这会将设备重置为使用其默认通道。
请求参数
请求参数部分interface Device { device_id: string app_id: string}示例请求
示例请求部分curl -X DELETE \ -H "authorization: your-api-key" \ -H "Content-Type: application/json" \ -d '{ "app_id": "app_123", "device_id": "device_456" }' \ https://api.capgo.app/device/成功响应
成功响应部分{ "status": "ok"}错误处理
错误处理部分常见错误场景和响应:
// Device not found{ "error": "Device not found", "status": "KO"}
// Invalid bundle (version){ "error": "Version not found", "status": "KO"}
// Invalid channel{ "error": "Channel not found", "status": "KO"}
// Permission denied{ "error": "Insufficient permissions to manage devices", "status": "KO"}常见用例
标题:常见用例- Beta 设备注册
{ "app_id": "app_123", "device_id": "device_456", "channel": "beta"}- 版本覆盖
{ "app_id": "app_123", "device_id": "device_456", "version_id": "1.1.0"}- 重置到默认频道
// Use DELETE endpoint to remove overrides设备管理的提示
标题:设备管理的提示- 监控: 定期检查设备状态和包(版本)分布
- 测试: 使用自定义 ID 方便地识别测试设备
- 故障排除: 跟踪设备更新和频道分配
- 原生版本控制: 监控原生应用版本以确保兼容性
继续从设备
: 继续使用设备如果您正在使用 : 使用设备 规划渠道路由和分阶段发布,连接 渠道 渠道 渠道 渠道 Beta 测试解决方案 为 Beta 测试解决方案中的产品工作流程 版本目标解决方案 为版本目标解决方案中的产品工作流程 编辑页面 protectedTokens