Apps
AppsはCapgoの基本的なエンティティです。各アプリは、プラットフォームを通じて管理および更新できる一意のCapacitorアプリケーションを表します。Apps APIを使用すると、アプリの設定を作成、取得、更新、削除できます。
Appsの理解
Section titled “Appsの理解”Capgoのアプリは、Capacitorアプリケーションを表し、以下を含みます:
- App ID: アプリケーションの一意の識別子
- Name: アプリケーションの人間が読める名前
- Icons: ダッシュボード内のアプリの視覚的な識別子
- Configuration: 更新の配信方法を制御する設定
- Ownership: 組織とユーザーのアクセス情報
- Usage Statistics: インストールと更新に関するメトリクス
ベストプラクティス
Section titled “ベストプラクティス”- 命名規則: アプリには明確で識別可能な名前を使用する
- セキュリティ: APIキーとアクセス認証情報を保護する
- 組織化: 関連するアプリを同じ組織の下にグループ化する
- 監視: アプリの統計とパフォーマンスを定期的に確認する
- バックアップ: 重要なアプリの設定バックアップを維持する
エンドポイント
Section titled “エンドポイント”https://api.capgo.app/app/
アプリに関する情報を取得します。
クエリパラメータ
Section titled “クエリパラメータ”page: オプション。ページネーションのページ番号limit: オプション。ページあたりの結果数(デフォルト: 50)org_id: オプション。組織IDでアプリをフィルタリング。提供されない場合、ユーザーがアクセスできるすべての組織のアプリを返します
特定のアプリを取得する場合:
- URLパスでアプリIDを使用:
https://api.capgo.app/app/:app_id
レスポンスタイプ
Section titled “レスポンスタイプ”interface App { app_id: string created_at: string | null default_upload_channel: string icon_url: string id: string | null last_version: string | null name: string | null owner_org: string retention: number transfer_history: Json[] | null updated_at: string | null user_id: string | null}リクエスト例
Section titled “リクエスト例”# すべてのアプリを取得curl -H "authorization: your-api-key" \ "https://api.capgo.app/app/"
# 特定の組織のアプリを取得curl -H "authorization: your-api-key" \ "https://api.capgo.app/app/?org_id=046a36ac-e03c-4590-9257-bd6c9dba9ee8"
# 特定のアプリを取得curl -H "authorization: your-api-key" \ "https://api.capgo.app/app/com.demo.app"レスポンス例
Section titled “レスポンス例”{ "data": [ { "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/
新しいアプリを作成します。
リクエストボディ
Section titled “リクエストボディ”interface CreateApp { app_id: string name: string icon?: string owner_org: string}リクエスト例
Section titled “リクエスト例”# 新しいアプリを作成curl -X POST \ -H "authorization: your-api-key" \ -H "Content-Type: application/json" \ -d '{ "name": "My New App", "app_id": "com.demo.myapp", // このIDはCapgoで一意です。どのアカウントでも再利用できません。 "icon": "https://example.com/icon.png", "owner_org": "046a36ac-e03c-4590-9257-bd6c9dba9ee8" }' \ https://api.capgo.app/app/成功レスポンス
Section titled “成功レスポンス”{ "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パスで指定します。
リクエストボディ
Section titled “リクエストボディ”interface UpdateApp { name?: string icon?: string retention?: number}リクエスト例
Section titled “リクエスト例”curl -X PUT \ -H "authorization: your-api-key" \ -H "Content-Type: application/json" \ -d '{ "name": "Updated App Name", "icon": "https://example.com/updated-icon.png", "retention": 45 }' \ https://api.capgo.app/app/com.demo.app成功レスポンス
Section titled “成功レスポンス”{ "app_id": "com.demo.app", "created_at": "2024-01-01T00:00:00Z", "default_upload_channel": "dev", "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"}DELETE
Section titled “DELETE”https://api.capgo.app/app/:app_id
アプリと関連するすべてのリソースを削除します。アプリIDはURLパスで指定します。この操作は元に戻せないため、細心の注意を払って使用してください。
リクエスト例
Section titled “リクエスト例”curl -X DELETE \ -H "authorization: your-api-key" \ https://api.capgo.app/app/com.demo.app成功レスポンス
Section titled “成功レスポンス”{ "status": "ok"}エラーハンドリング
Section titled “エラーハンドリング”一般的なエラーシナリオとそのレスポンス:
// アプリが見つかりません{ "error": "App not found", "status": "KO"}
// カスタムIDの重複{ "error": "Custom ID already in use", "status": "KO"}
// 無効なパラメータ{ "error": "Invalid app configuration", "status": "KO"}
// 権限拒否{ "error": "Insufficient permissions to manage app", "status": "KO"}
// 組織アクセス拒否{ "status": "You do not have access to this organization"}一般的なユースケース
Section titled “一般的なユースケース”- 新しいアプリの作成
// 新しいアプリをセットアップ{ "name": "Production App", "owner_org": "046a36ac-e03c-4590-9257-bd6c9dba9ee8"}- アプリ設定の更新
// アプリ名とアイコンを変更{ "name": "Rebranded App Name", "icon": "https://example.com/new-icon.png"}- 保持ポリシーの設定
// 自動バンドルクリーンアップを設定{ "retention": 30 // バンドルを30日間保持}- 組織別にアプリを取得
# 特定の組織のすべてのアプリをリスト表示curl -H "authorization: your-api-key" \ "https://api.capgo.app/app/?org_id=046a36ac-e03c-4590-9257-bd6c9dba9ee8"リソース管理
Section titled “リソース管理”- ストレージの最適化: ストレージ使用量を監視し、適切な保持ポリシーを設定
- 組織化: 関連するアプリを単一の組織の下にグループ化
- アクセス制御: アプリ設定を変更できるチームメンバーを管理
- バックアップ戦略: 重要なアプリの設定と設定をバックアップ