組織
このプラグインのインストール手順と全マークダウンガイドを含む設定プロンプトをコピーする
Capgo のトップ レベル エンティティは組織です。組織を使用して、アプリ、チーム メンバー、リソースを 1 つの屋根の下にグループ化できます。各組織には、異なる役割と権限を持つ複数のメンバーが存在できます。
一般的な使用例
組織の一般的な使用例- 会社用に新しい組織を作成する
- 組織の設定を管理する
- 組織情報を更新する
- 組織の詳細を取得する
エンドポイント
エンドポイントGET
GEThttps://api.capgo.app/organization/
組織情報を取得します。指定されたパラメータが存在する場合、特定の組織を返します。そうでない場合は、すべてのアクセス可能な組織を返します。 orgId クエリ パラメータ
orgIdレスポンスのタイプ
コピー
例のリクエストinterface Organization { id: string created_by: string created_at: string updated_at: string logo: string | null name: string management_email: string customer_id: string | null}pagePath
例のリクエスト# Get all organizationscurl -H "x-api-key: YOUR_API_KEY" https://api.capgo.app/organization/
# Get specific organizationcurl -H "x-api-key: YOUR_API_KEY" https://api.capgo.app/organization/?orgId=org_123例のレスポンス
例のレスポンス{ "data": { "id": "org_123", "name": "My Company", "created_at": "2024-01-01T00:00:00Z", "updated_at": "2024-01-01T00:00:00Z", "logo": "https://example.com/logo.png", "management_email": "admin@example.com", "customer_id": "cus_123" }}POST
POSThttps://api.capgo.app/organization/
新しい組織を作成します。
API キーを使用する場合、キーにはグローバル org.create 許可と現在の組織スコープ org_admin または org_super_admin バインディング。 この要求は、対象の組織がまだ存在しないため、通常の組織スコープのRBACがチェックできないため、必要です。
要求が成功した場合、Capgoは自動的に同じAPIキーをCapgoに割り当てます。 org_super_admin 新しい組織。
Allow creating organizations
when creating the key through the __CAPGO_KEEP_0__.interface OrganizationCreate { name: string email?: string estimatedMau?: number website?: string}サンプル リクエスト
「サンプル リクエスト」のセクションcurl -X POST \ -H "x-api-key: YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "name": "New Organization", "email": "admin@example.com", "website": "https://example.com" }' \ https://api.capgo.app/organization/サンプル レスポンス
「サンプル レスポンス」のセクション{ "id": "org_456"}権限エラー
「権限エラー」のセクション API キーが存在しない場合、API は org.create API が返されます:
{ "error": "permission_denied"}PUT
PUThttps://api.capgo.app/organization/
PUT
組織の更新
リクエストボディinterface OrganizationUpdate { orgId: string logo?: string name?: string management_email?: string}リクエストの例
ターミナル画面curl -X PUT \ -H "x-api-key: YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "orgId": "org_123", "name": "New Company Name", "management_email": "newemail@example.com" }' \ https://api.capgo.app/organization/リクエストボディ
リクエストの例{ "status": "Organization updated", "data": { "id": "org_123", "name": "New Company Name", "management_email": "newemail@example.com" }}DELETE
「DELETE」のセクションhttps://api.capgo.app/organization/
既存の組織を削除します。対象の組織に対して削除権限が必要です。通常はロールを通じて実行されます。このアクションは不可逆的で、関連するすべてのアプリ、バンドル(バージョン)、リソースを削除します。 org_super_admin 削除する組織のID
グローバルな権限では組織を削除することはできません。 org.create クエリ パラメータ
削除する組織のID
例えばリクエストorgId「例えばリクエスト」のセクション
Section titled “DELETE”
Section titled “Query Parameters”curl -X DELETE \ -H "x-api-key: YOUR_API_KEY" \ https://api.capgo.app/organization/?orgId=org_123例のレスポンス
「例のレスポンス」のセクション{ "status": "ok"}エラー処理
「エラー処理」のセクション一般的なエラーシナリオとそのレスポンス:
// Invalid API key{ "error": "Invalid API key", "status": "KO"}
// Missing required field{ "error": "Name is required", "status": "KO"}
// Insufficient permissions{ "error": "Admin role required", "status": "KO"}ベストプラクティス
「ベストプラクティス」のセクション- 命名規則組織の名前を明確で説明的なものに設定してください
- 役割組織メンバーに適切な役割を割り当ててください
- メールアドレス組織のロゴ
- 信頼できるCDNでロゴをホストし、HTTPSのURLを使用してください組織から続けて
組織から続けてください
組織を使用してダッシュボードと__CAPGO_KEEP_0__の運用を計画している場合、 組織 to plan dashboard and API operations, connect it with API Overview API の概要 Introduction __CAPGO_KEEP_0__ の実装詳細について API Keys API キーの実装詳細について Devices デバイスの実装詳細について Bundles バンドルの実装詳細について