コンテンツへスキップ

Devices

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

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

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

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

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

interface DeviceLink {
app_id: string
device_id: string
version_id?: string // 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; // 次のページを取得するために、これを'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;
}
{
"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/

デバイスをチャネルオーバーライドからリンク解除します。これにより、デバイスがデフォルトチャネルを使用するようにリセットされます。

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 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. Beta Device Registration
{
"app_id": "app_123",
"device_id": "device_456",
"channel": "beta"
}
  1. Version Override
{
"app_id": "app_123",
"device_id": "device_456",
"version_id": "1.1.0"
}
  1. Reset to Default Channel
// Use DELETE endpoint to remove overrides
  1. 監視: デバイスのステータスとバージョンの分布を定期的に確認します
  2. テスト: カスタムIDを使用して、テストデバイスを簡単に識別します
  3. トラブルシューティング: デバイスの更新とチャネル割り当てを追跡します
  4. バージョン管理: 互換性を確保するために、ネイティブアプリのバージョンを監視します