Devices
Devicesは、Capgoによって管理されるアプリの個別のインストールを表します。Devices APIを使用すると、バージョン、チャネル、更新ステータスを含むデバイスを追跡および管理できます。
Devicesを理解する
Section titled “Devicesを理解する”各デバイスには固有の特性と状態があります:
- Platform: iOSまたはAndroid
- Version: 現在のバンドルバージョンとネイティブビルドバージョン
- Environment: 本番環境または開発環境、エミュレーターまたは物理デバイス
- Channel: 現在の更新チャネル割り当て
- Custom ID: 独自の追跡目的のためのオプションの識別子
ベストプラクティス
Section titled “ベストプラクティス”- バージョン追跡: デバイスのバージョンを監視して、更新の採用を確保します
- チャネル管理: テストのニーズに基づいて、適切なチャネルにデバイスを割り当てます
- 環境の認識: 異なる環境(本番/開発/エミュレーター)を適切に処理します
- カスタム識別: カスタムIDを使用して、既存のシステムと統合します
Endpoints
Section titled “Endpoints”https://api.capgo.app/device/
デバイスを特定のバージョンまたはチャネルにリンクします。
Request Body
Section titled “Request Body”interface DeviceLink { app_id: string device_id: string version_id?: string // version name channel?: string // channel name}リクエスト例
Section titled “リクエスト例”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/成功レスポンス
Section titled “成功レスポンス”{ "status": "ok"}https://api.capgo.app/device/
デバイス情報を取得します。大規模なデバイスリストの効率的な取得のために、カーソルベースのページネーションを使用します。
クエリパラメータ
Section titled “クエリパラメータ”app_id: 必須。アプリのIDdevice_id: オプション。単一のデバイスを取得するための特定のデバイスIDcursor: オプション。ページネーション用の前のレスポンスからのカーソルlimit: オプション。ページごとのデバイス数(デフォルト:50)
リクエスト例s
Section titled “リクエスト例s”# 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"レスポンスタイプ(リスト)
Section titled “レスポンスタイプ(リスト)”複数のデバイスを要求する場合(device_idパラメータなし):
interface DeviceListResponse { data: Device[]; nextCursor?: string; // 次のページを取得するために、これを'cursor'パラメータとして渡します hasMore: boolean; // より多くのページが利用可能な場合はtrue}
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"; plugin_version: string; os_version: string; version_build: string; is_prod: boolean; is_emulator: boolean;}レスポンスタイプ(単一デバイス)
Section titled “レスポンスタイプ(単一デバイス)”device_idパラメータを使用して特定のデバイスを要求すると、デバイスオブジェクトを直接返します:
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"; plugin_version: string; os_version: string; version_build: string; is_prod: boolean; is_emulator: boolean;}レスポンス例(リスト)
Section titled “レスポンス例(リスト)”{ "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}レスポンス例(単一デバイス)
Section titled “レスポンス例(単一デバイス)”{ "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"}DELETE
Section titled “DELETE”https://api.capgo.app/device/
デバイスをチャネルオーバーライドからリンク解除します。これにより、デバイスがデフォルトチャネルを使用するようにリセットされます。
Query Parameters
Section titled “Query Parameters”interface Device { device_id: string app_id: string}リクエスト例
Section titled “リクエスト例”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/成功レスポンス
Section titled “成功レスポンス”{ "status": "ok"}一般的なエラーシナリオとそのレスポンス:
// Device not found{ "error": "Device not found", "status": "KO"}
// Invalid 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"}一般的な使用例
Section titled “一般的な使用例”- Beta Device Registration
{ "app_id": "app_123", "device_id": "device_456", "channel": "beta"}- Version Override
{ "app_id": "app_123", "device_id": "device_456", "version_id": "1.1.0"}- Reset to Default Channel
// Use DELETE endpoint to remove overridesデバイス管理のヒント
Section titled “デバイス管理のヒント”- 監視: デバイスのステータスとバージョンの分布を定期的に確認します
- テスト: カスタムIDを使用して、テストデバイスを簡単に識別します
- トラブルシューティング: デバイスの更新とチャネル割り当てを追跡します
- バージョン管理: 互換性を確保するために、ネイティブアプリのバージョンを監視します