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

アプリ

Apps は Capgo の基盤となるエンティティです。各 App は、プラットフォームを通じて管理・更新できる独自の Capacitor アプリケーションを表します。Apps API を使用して、アプリ設定の作成、取得、更新、削除を行うことができます。

Capgo における App は、あなたの Capacitor アプリケーションを表し、以下を含みます:

  • App ID:アプリケーションの一意な識別子
  • 名称: アプリケーションの人間が読める名前
  • アイコン: ダッシュボード上のアプリのビジュアル識別子
  • 設定: アップデート配信を制御する設定
  • 所有権: 組織とユーザーのアクセス情報
  • 利用統計: インストールとアップデートのメトリクス
  1. 命名規則: アプリには明確で識別しやすい名前を付けてください
  2. セキュリティ: API キーとアクセス認証情報を保護します
  3. 組織: 関連するアプリを同じ組織内にグループ化します
  4. モニタリング: アプリの統計情報とパフォーマンスを定期的に確認します
  5. バックアップ: 重要なアプリの設定バックアップを維持します

エンドポイント

「Endpoints」セクション

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

アプリに関する情報を取得します。

  • page: 任意。ページネーション用のページ番号
  • limit: 任意。1ページあたりの結果数(デフォルト: 50)
  • org_id: 任意。組織IDでアプリをフィルタリングします。指定しない場合、ユーザーがアクセス可能なすべての組織のアプリが返されます

特定のアプリを取得するには:

  • URLパスにアプリIDを使用します: https://api.capgo.app/app/:app_id

注意: last_version アプリにアップロードされた最後のバンドル(バージョン)を指します。

interface App {
app_id: string
block_provider_infra_requests: boolean
created_at: string | null
default_upload_channel: string
icon_url: string
id: string | null
last_version: string | null // last bundle (version) name
name: string | null
owner_org: string
retention: number
transfer_history: Json[] | null
updated_at: string | null
user_id: string | null
}
ターミナル
# Get all apps
curl -H "authorization: your-api-key" \
"https://api.capgo.app/app/"
# Get apps from a specific organization
curl -H "authorization: your-api-key" \
"https://api.capgo.app/app/?org_id=046a36ac-e03c-4590-9257-bd6c9dba9ee8"
# Get specific app
curl -H "authorization: your-api-key" \
"https://api.capgo.app/app/com.demo.app"
{
"data": [
{
"block_provider_infra_requests": true,
"app_id": "com.demo.app",
"created_at": "2024-01-01T00:00:00Z",
"default_upload_channel": "dev",
"icon_url": "https://example.com/icon.png",
"id": "550e8400-e29b-41d4-a716-446655440000",
"last_version": "1.0.0",
"name": "Demo App",
"owner_org": "046a36ac-e03c-4590-9257-bd6c9dba9ee8",
"retention": 2592000,
"transfer_history": null,
"updated_at": "2024-01-01T00:00:00Z",
"user_id": "6aa76066-55ef-4238-ade6-0b32334a4097"
}
]
}

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

新しいアプリを作成します。

interface CreateApp {
app_id: string
name: string
icon?: string
owner_org: string
}
ターミナル
# Create new app
curl -X POST \
-H "authorization: your-api-key" \
-H "Content-Type: application/json" \
-d '{
"name": "My New App",
"app_id": "com.demo.myapp", // this id is unique in Capgo This cannot be reused by any account.
"icon": "https://example.com/icon.png",
"owner_org": "046a36ac-e03c-4590-9257-bd6c9dba9ee8"
}' \
https://api.capgo.app/app/
{
"block_provider_infra_requests": true,
"app_id": "My New App",
"created_at": "2024-01-01T00:00:00Z",
"default_upload_channel": "dev",
"icon_url": "https://example.com/icon.png",
"id": "550e8400-e29b-41d4-a716-446655440000",
"name": "My New App",
"owner_org": "046a36ac-e03c-4590-9257-bd6c9dba9ee8",
"retention": 2592000,
"updated_at": "2024-01-01T00:00:00Z"
}

https://api.capgo.app/app/:app_id

既存のアプリを更新します。アプリIDはURLパスで指定します。

interface UpdateApp {
block_provider_infra_requests?: boolean
name?: string
icon?: string
retention?: number
}
ターミナル
curl -X PUT \
-H "authorization: your-api-key" \
-H "Content-Type: application/json" \
-d '{
"block_provider_infra_requests": true,
"name": "Updated App Name",
"icon": "https://example.com/updated-icon.png",
"retention": 45
}' \
https://api.capgo.app/app/com.demo.app
{
"app_id": "com.demo.app",
"created_at": "2024-01-01T00:00:00Z",
"default_upload_channel": "dev",
"block_provider_infra_requests": true,
"icon_url": "https://example.com/updated-icon.png",
"id": "550e8400-e29b-41d4-a716-446655440000",
"name": "Updated App Name",
"owner_org": "046a36ac-e03c-4590-9257-bd6c9dba9ee8",
"retention": 45,
"updated_at": "2024-01-01T00:00:00Z"
}

https://api.capgo.app/app/:app_id

アプリと関連するすべてのリソースを削除します。アプリIDはURLパスで指定します。この操作は取り消せないため、細心の注意を払って使用してください。

ターミナル
curl -X DELETE \
-H "authorization: your-api-key" \
https://api.capgo.app/app/com.demo.app
{
"status": "ok"
}

すべてのエラーは、以下で説明する標準エラー形式に従います API の概要.

よくあるエラーシナリオとそのレスポンス:

// Missing or invalid API key (HTTP 401)
{
"error": "invalid_apikey",
"message": "Invalid apikey",
"moreInfo": {}
}
// app_id is not a reverse-domain identifier
{
"error": "invalid_app_id",
"message": "App ID must be a reverse domain string",
"moreInfo": { "app_id": "my app" }
}
// The API key has no access to this app (HTTP 401)
{
"error": "cannot_access_app",
"message": "You can't access this app",
"moreInfo": { "app_id": "com.example.app" }
}
// Creating an app in an organization the key cannot write to (HTTP 403)
{
"error": "cannot_access_organization",
"message": "You can't access this organization",
"moreInfo": { "org_id": "046a36ac-e03c-4590-9257-bd6c9dba9ee8" }
}
// Retention above the two-year limit on update
{
"error": "retention_to_big",
"message": "Retention cannot be bigger than 63113903 (2 years)",
"moreInfo": { "retention": 99999999 }
}
  1. 新しいAppを作成
// Set up a new app
{
"name": "Production App",
"owner_org": "046a36ac-e03c-4590-9257-bd6c9dba9ee8"
}
  1. Appの設定を更新
// Change app name and icon
{
"name": "Rebranded App Name",
"icon": "https://example.com/new-icon.png"
}
  1. 保持ポリシーを設定
// Configure automatic bundle cleanup
{
"retention": 30 // Keep bundles for 30 days
}
  1. Organization別にAppを取得
ターミナル
# List all apps in a specific organization
curl -H "authorization: your-api-key" \
"https://api.capgo.app/app/?org_id=046a36ac-e03c-4590-9257-bd6c9dba9ee8"
  1. ストレージの最適化: ストレージ使用量を監視し、適切な保持ポリシーを設定します
  2. 組織: 関連するアプリを1つの組織にまとめます
  3. アクセス制御: アプリ設定を変更できるチームメンバーを管理します
  4. バックアップ戦略: 重要なアプリの構成と設定をバックアップします

使用している場合 アプリ ダッシュボードと API の運用を計画するには、これを次と連携させます API の概要 「API の概要」の実装の詳細については、 はじめに 「はじめに」における実装の詳細については、 API キー API Keys の実装の詳細については、 デバイス Devices の実装詳細については、および Bundle Bundlesの実装詳細については