メインコンテンツにジャンプ

デバイス

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

各レコードには、デバイスID、プラットフォーム、アップデータとOSバージョン、ネイティブビルド、インストールされたバンドル、生産とエミュレーターの状態、カスタムID、チャネルオーバーライドが含まれます。

利用可能な場合、 country_code は、code を取得したCloudflare-ハンドルされたリクエストのデバイスの最新の有効な2桁のISO 3166-1国コードです。GPSまたはアプリから提供された場所の値ではありません。利用可能な場合、利用可能ですが、利用できない場合、単一デバイスの検索を使用してこのフィールドを使用してください。 null データ保持期間

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

デバイス固有のオーバーライドを プライベート チャンネルに設定します。デバイスごとのバンドルオーバーライドはサポートされていません。

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: __CAPGO_KEEP_0__ ID (任意)。__CAPGO_KEEP_0__ が指定されている場合、レスポンスは 1 つのデバイスのみであり、ページネーションリストではありません。
  • customIdMode: __CAPGO_KEEP_0__ (任意)。__CAPGO_KEEP_0__ を "true" に設定すると、__CAPGO_KEEP_1__ が空でないデバイスのみを返します。 true : __CAPGO_KEEP_0__ (任意)。__CAPGO_KEEP_0__ を指定すると、前のレスポンスから取得したカーソルが使用されます。 custom_id.
  • cursor: __CAPGO_KEEP_0__ (任意)。__CAPGO_KEEP_0__ を指定すると、1 ページあたりのデバイス数が指定されます。
  • limit

例のリクエスト

ターミナル画面
コピー
# 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がCapgoに保存されている場合に、デバイス固有の検索によって埋められます。有効な国が存在しないリクエストは、最後に有効な値をクリアしません; リストのレスポンスは 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 デバイスをパブリック チャネルにオーバーライドしようとした場合。
  • public_channel_override 直接バンドル オーバーライドを試みている場合; チャネルを使用してください。
  • invalid_version_id または
  • cannot_access_app __CAPGO_KEEP_0__ キーが必要な権限を欠いている場合。 cannot_access_channel when the API key lacks the required permission.

「一般的な使用例」というセクション

Section titled “Common use cases”
  1. Move a test device to a private beta channel

    {
    "app_id": "com.example.app",
    "device_id": "device_456",
    "channel": "beta"
    }
  2. Reset a device to normal channel selection

    Use the DELETE endpoint with the app and device IDs.

If you are using Devices to plan channel routing and staged rollout, connect it with Channels for the implementation detail in Channels, チャンネル __CAPGO_KEEP_0__ チャンネル __CAPGO_KEEP_0__ ベータテスト ソリューション __CAPGO_KEEP_0__ バージョン ターゲット ソリューション __CAPGO_KEEP_0__