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

デバイス

Deviceとは、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/

デバイス固有のオーバーライドを private channel に設定します。デバイスに特定の bundle を割り当てるには、その bundle を channel に割り当ててください。デバイスごとの直接的な bundle オーバーライドはサポートされていません。オーバーライドは、再度 POST しない限り、最後に書き込まれてから 90 日後に期限切れとなります。

リクエストボディ

「Request body」セクション
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/

パブリックチャンネルはデバイスの上書き(override)には使用できません。

{
"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ステータスコードと、以下のフィールドを含む error と message JSONボディで返されます。主なエラーコードは以下の通りです:

  • 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を指定するエンドポイント。

以下を使用している場合: デバイス チャネルのルーティングと段階的ロールアウトを計画するには、それを次と接続します チャネル Channelsの実装の詳細については、 チャネル Channelsの実装の詳細については、 チャネル Channelsの実装の詳細については、 ベータテスト・ソリューション Beta Testing Solutionのプロダクトワークフロー向けに、また バージョン指定ソリューション Version Targeting Solutionのプロダクトワークフロー向けに。