メインコンテンツへスキップ

デバイス

デバイスとは、Capgo にアップデータのメタデータを報告する個々のアプリインストールです。この API を使うと、そのメタデータを取得したり、デバイス固有のプライベートチャネルのオーバーライドを設定・削除したりできます。

各レコードには、デバイスID、プラットフォーム、updaterおよびOSのバージョン、Native Build、インストール済みのbundle、本番環境およびエミュレータの状態、カスタムID、channelのオーバーライドを含めることができます。

利用可能な場合、 country_code は、デバイスに対してCloudflareが処理したリクエストから受け取った、最新の有効なISO 3166-1 2文字の国codeです。GPSやアプリが提供する位置情報ではありません。値は null 利用できない場合。このフィールドが必要なときは、単一デバイスのルックアップを使用してください。

エンドポイント

「Endpoints」セクション

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

デバイス固有のオーバーライドを プライベート チャネルに設定します。デバイス用の bundle を選ぶには、その bundle をチャネルに割り当ててください。デバイスごとの bundle 直接オーバーライドはサポートされていません。オーバーライドは、再度 POST しない限り、最後の書き込みから 90 日後に期限切れになります。

interface DeviceChannelOverride {
app_id: string; // reverse-domain app ID, for example com.example.app
device_id: string;
channel: string; // existing non-public channel name
}
ターミナル
curl -X POST \
-H "authorization: your-api-key" \
-H "Content-Type: application/json" \
-d '{
"app_id": "com.example.app",
"device_id": "device_456",
"channel": "beta"
}' \
https://api.capgo.app/device/

パブリックチャンネルはデバイスオーバーライドとして使用できません。

{
"status": "ok"
}

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

デバイスのメタデータを取得します。省略した場合、結果はカーソルページネーションされます。 device_id.

  • app_id: 必須の逆ドメイン形式のアプリ ID。例: com.example.app.
  • device_id: 任意のデバイス ID。指定すると、ページネーション付きリストではなく単一のデバイスが返されます。
  • customIdMode: 任意のブール値。 true に設定すると、空でない custom_id.
  • cursor: 任意の、前回のリスト応答からのカーソル。
  • limit: 任意の、1ページあたりのデバイス数。
ターミナル
# Get the first page
curl -H "authorization: your-api-key" \
"https://api.capgo.app/device/?app_id=com.example.app"
# Get one device, including its request-derived country when available
curl -H "authorization: your-api-key" \
"https://api.capgo.app/device/?app_id=com.example.app&device_id=device_456"
# Get only devices with a custom ID
curl -H "authorization: your-api-key" \
"https://api.capgo.app/device/?app_id=com.example.app&customIdMode=true"
# Get the next page
curl -H "authorization: your-api-key" \
"https://api.capgo.app/device/?app_id=com.example.app&cursor=2024-01-01T00:00:00Z%7Cdevice_456"
interface DeviceListResponse {
data: Device[];
nextCursor?: string;
hasMore: boolean;
}
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" | "electron";
plugin_version: string;
os_version: string;
version_build: string;
is_prod: boolean;
is_emulator: boolean;
key_id: string | null;
install_source: string | null;
country_code: string | null;
}

country_code Capgo が有効な Cloudflare 由来の国 code を保存している場合、デバイス固有のルックアップによって値が設定されます。有効な国を持たないリクエストでも、最後に有効だった値はクリアされません。リストのレスポンスは以下を返す場合があります。 null このフィールドに対して。

{
"data": [
{
"device_id": "device_456",
"custom_id": "test-device-1",
"version": 1,
"version_name": "1.0.0",
"app_id": "com.example.app",
"platform": "ios",
"plugin_version": "5.0.0",
"os_version": "17.0",
"version_build": "1",
"is_prod": true,
"is_emulator": false,
"key_id": null,
"install_source": null,
"country_code": null,
"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": "com.example.app",
"platform": "ios",
"plugin_version": "5.0.0",
"os_version": "17.0",
"version_build": "1",
"is_prod": true,
"is_emulator": false,
"key_id": "MIIB",
"install_source": null,
"country_code": "FR",
"updated_at": "2024-01-01T00:00:00Z",
"channel": "beta"
}

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

デバイスのチャンネルオーバーライドを削除します。デバイスは通常のチャンネル選択に戻ります。このエンドポイントはメタデータレコードを削除しません。

リクエストボディまたはクエリパラメータ

セクション「リクエストボディまたはクエリパラメータ」
interface DeviceOverrideRemoval {
app_id: string;
device_id: string;
}
ターミナル
curl -X DELETE \
-H "authorization: your-api-key" \
-H "Content-Type: application/json" \
-d '{
"app_id": "com.example.app",
"device_id": "device_456"
}' \
https://api.capgo.app/device/
{
"status": "ok"
}

エラーはHTTPエラーステータスと、 error と message フィールドを持つJSONボディで返されます。一般的なエラーコードには以下があります:

  • invalid_app_id いつ app_id がリバーシドメイン識別子ではありません。
  • device_not_found 不明なデバイスの参照の場合。
  • channel_not_found 要求されたチャネルが存在しない場合。
  • public_channel_override デバイスをパブリックチャネルに上書きしようとした場合。
  • invalid_version_id バンドルの直接上書きを試みた場合。代わりにチャネルを使用してください。
  • cannot_access_app または cannot_access_channel API キーに必要な権限がない場合。
  1. テストデバイスをプライベートベータチャネルに移動する

    {
    "app_id": "com.example.app",
    "device_id": "device_456",
    "channel": "beta"
    }
  2. デバイスを通常のチャネル選択に戻す

    以下の DELETE アプリIDとデバイスIDを指定するエンドポイント。

Devices の次のステップ

「Devices」からの次のステップ

使用している場合 デバイス チャンネルルーティングと段階的ロールアウトを計画するには、次と組み合わせてください: チャンネル Channelsの実装の詳細については、 チャンネル Channelsの実装の詳細については、 チャンネル Channelsの実装の詳細については、 ベータテストソリューション ベータテストソリューションのプロダクトワークフロー向け、および バージョンターゲティングソリューション バージョンターゲティングソリューションのプロダクトワークフロー向け。