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

デバイス

デバイスとは、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: 任意(boolean)。 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ステータスコードと、以下のフィールドを含むJSONボディで返されます。 error と message 一般的なエラーコードは以下の通りです:

  • invalid_app_id いつ app_id はリバースドメイン形式の識別子ではありません。
  • device_not_found 不明なデバイスの検索が行われました。
  • channel_not_found 指定されたchannelが存在しません。
  • public_channel_override デバイスをパブリックなchannelへ上書きしようとしています。
  • invalid_version_id 直接bundleを上書きしようとしています。代わりにchannelを使用してください。
  • 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の実装の詳細については、 ベータテストソリューション ベータテストソリューションのプロダクトワークフロー向け、および バージョンターゲティングソリューション バージョンターゲティングソリューションのプロダクトワークフロー向け。