コンテンツにジャンプする

組織

Capgo のトップ レベル エンティティは組織です。組織を使用して、アプリ、チーム メンバー、リソースを 1 つの屋根の下にグループ化できます。各組織には、異なる役割と権限を持つ複数のメンバーが存在できます。

一般的な使用例

組織の一般的な使用例
  • 会社用に新しい組織を作成する
  • 組織の設定を管理する
  • 組織情報を更新する
  • 組織の詳細を取得する

エンドポイント

エンドポイント

GET

GET

https://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
}
ターミナル画面
# Get all organizations
curl -H "x-api-key: YOUR_API_KEY" https://api.capgo.app/organization/
# Get specific organization
curl -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

POST

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

新しい組織を作成します。

API キーを使用する場合、キーにはグローバル org.create 許可と現在の組織スコープ org_admin または org_super_admin バインディング。 この要求は、対象の組織がまだ存在しないため、通常の組織スコープのRBACがチェックできないため、必要です。

要求が成功した場合、Capgoは自動的に同じAPIキーをCapgoに割り当てます。 org_super_admin 新しい組織。

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

PUT

https://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"
}
}

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"
}
  1. 命名規則組織の名前を明確で説明的なものに設定してください
  2. 役割組織メンバーに適切な役割を割り当ててください
  3. メールアドレス組織のロゴ
  4. 信頼できる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 バンドルの実装詳細について