コンテンツへスキップ

Devices

デバイスは、Capgo によって管理されるアプリの個々のインストールを表します。デバイス API を使用すると、デバイスのバンドル (バージョン)、チャネル、更新ステータスなどを追跡および管理できます。

各デバイスには固有の特性と状態があります。

  • プラットフォーム: iOS、Android、または Electron
  • バンドル (バージョン): 現在のバンドル (バージョン) とネイティブ ビルド バージョン
  • 環境: 本番環境または開発環境、エミュレータまたは物理デバイス
  • チャンネル: 現在の更新チャンネルの割り当て
  • カスタム ID: 独自の追跡目的のためのオプションの識別子
  1. バンドル (バージョン) 追跡: デバイス バンドル (バージョン) の導入を監視して、更新プログラムの取り込みを確認します。
  2. チャネル管理: テストのニーズに基づいてデバイスを適切なチャネルに割り当てます。
  3. 環境認識: さまざまな環境 (本番/開発/エミュレータ) を適切に処理します。
  4. カスタム ID: カスタム ID を使用して既存のシステムと統合します

https://api.capgo.app/device/

デバイスを特定のバンドル (バージョン) またはチャネルにリンクします。

interface DeviceLink {
app_id: string
device_id: string
version_id?: string // bundle (version) name
channel?: string // channel name
}
Terminal window
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/

デバイス情報を取得します。カーソルベースのページネーションを使用して、大規模なデバイスリストを効率的に取得します。

  • app_id: 必須。アプリのID
  • device_id: オプション。単一のデバイスを取得するための特定のデバイス ID
  • cursor: オプション。ページネーションのための前の応答のカーソル
  • limit: オプション。ページごとのデバイス数 (デフォルト: 50)
Terminal window
# Get all devices (first page)
curl -H "authorization: your-api-key" \
"https://api.capgo.app/device/?app_id=app_123"
# Get specific device
curl -H "authorization: your-api-key" \
"https://api.capgo.app/device/?app_id=app_123&device_id=device_456"
# Get next page using cursor
curl -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")
}
{
"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
}
Terminal window
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"
}
  1. ベータ版デバイスの登録
{
"app_id": "app_123",
"device_id": "device_456",
"channel": "beta"
}
  1. バージョンの上書き
{
"app_id": "app_123",
"device_id": "device_456",
"version_id": "1.1.0"
}
  1. デフォルトのチャンネルにリセット
// Use DELETE endpoint to remove overrides
```## デバイス管理のヒント
1. **監視**: デバイスのステータスとバンドル (バージョン) の配布を定期的に確認します。
2. **テスト**: カスタム ID を使用してテスト デバイスを簡単に識別します
3. **トラブルシューティング**: デバイスの更新とチャネル割り当てを追跡する
4. **ネイティブ バージョン管理**: ネイティブ アプリのバージョンを監視して互換性を確保します