Devices
デバイスは、Capgo によって管理されるアプリの個々のインストールを表します。デバイス API を使用すると、デバイスのバンドル (バージョン)、チャネル、更新ステータスなどを追跡および管理できます。
デバイスについて
Section titled “デバイスについて”各デバイスには固有の特性と状態があります。
- プラットフォーム: iOS、Android、または Electron
- バンドル (バージョン): 現在のバンドル (バージョン) とネイティブ ビルド バージョン
- 環境: 本番環境または開発環境、エミュレータまたは物理デバイス
- チャンネル: 現在の更新チャンネルの割り当て
- カスタム ID: 独自の追跡目的のためのオプションの識別子
ベストプラクティス
Section titled “ベストプラクティス”- バンドル (バージョン) 追跡: デバイス バンドル (バージョン) の導入を監視して、更新プログラムの取り込みを確認します。
- チャネル管理: テストのニーズに基づいてデバイスを適切なチャネルに割り当てます。
- 環境認識: さまざまな環境 (本番/開発/エミュレータ) を適切に処理します。
- カスタム ID: カスタム ID を使用して既存のシステムと統合します
エンドポイント
Section titled “エンドポイント”https://api.capgo.app/device/
デバイスを特定のバンドル (バージョン) またはチャネルにリンクします。
リクエスト本文
Section titled “リクエスト本文”interface DeviceLink { app_id: string device_id: string version_id?: string // bundle (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/{ "status": "ok"}https://api.capgo.app/device/
デバイス情報を取得します。カーソルベースのページネーションを使用して、大規模なデバイスリストを効率的に取得します。
クエリパラメータ
Section titled “クエリパラメータ”app_id: 必須。アプリのIDdevice_id: オプション。単一のデバイスを取得するための特定のデバイス IDcursor: オプション。ページネーションのための前の応答のカーソルlimit: オプション。ページごとのデバイス数 (デフォルト: 50)
リクエストの例
Section titled “リクエストの例”# 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; // 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")}応答タイプ (単一デバイス)
Section titled “応答タイプ (単一デバイス)”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")}応答例 (リスト)
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"}https://api.capgo.app/device/
チャネルオーバーライドからデバイスのリンクを解除します。これにより、デバイスがデフォルトのチャネルを使用するようにリセットされます。
クエリパラメータ
Section titled “クエリパラメータ”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/{ "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"}一般的な使用例
Section titled “一般的な使用例”- ベータ版デバイスの登録
{ "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```## デバイス管理のヒント
1. **監視**: デバイスのステータスとバンドル (バージョン) の配布を定期的に確認します。2. **テスト**: カスタム ID を使用してテスト デバイスを簡単に識別します3. **トラブルシューティング**: デバイスの更新とチャネル割り当てを追跡する4. **ネイティブ バージョン管理**: ネイティブ アプリのバージョンを監視して互換性を確保します