Organizations
組織は、Capgo の最上位のエンティティです。これにより、アプリ、チームメンバー、リソースを 1 つの傘の下にグループ化できます。各組織には、異なる役割と権限を持つ複数のメンバーが存在できます。
一般的な使用例
Section titled “一般的な使用例”- 会社の新しい組織を作成する
- 組織設定の管理
- 組織情報の更新
- 組織の詳細の取得
エンドポイント
Section titled “エンドポイント”https://api.capgo.app/organization/
組織情報を取得します。パラメータに orgId が指定されている場合は、単一の組織を返します。それ以外の場合は、アクセス可能なすべての組織を返します。
クエリパラメータ
Section titled “クエリパラメータ”orgId(オプション): 取得する特定の組織の ID
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}リクエストの例
Section titled “リクエストの例”# Get all organizationscurl -H "authorization: your-api-key" https://api.capgo.app/organization/
# Get specific organizationcurl -H "authorization: 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" }}https://api.capgo.app/organization/
新しい組織を作成します。
リクエスト本文
Section titled “リクエスト本文”interface OrganizationCreate { name: string}リクエストの例
Section titled “リクエストの例”curl -X POST \ -H "authorization: your-api-key" \ -H "Content-Type: application/json" \ -d '{ "name": "New Organization" }' \ https://api.capgo.app/organization/{ "status": "Organization created", "id": "org_456"}https://api.capgo.app/organization/
既存の組織を更新します。管理者の役割が必要です。
リクエスト本文
Section titled “リクエスト本文”interface OrganizationUpdate { orgId: string logo?: string name?: string management_email?: string}リクエストの例
Section titled “リクエストの例”curl -X PUT \ -H "authorization: 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/
既存の組織を削除します。管理者の役割が必要です。この操作は元に戻すことができず、関連するすべてのアプリ、バンドル (バージョン)、およびリソースが削除されます。
クエリパラメータ
Section titled “クエリパラメータ”orgId: 削除する組織のID
リクエストの例
Section titled “リクエストの例”curl -X DELETE \ -H "authorization: your-api-key" \ https://api.capgo.app/organization/?orgId=org_123{ "status": "Organization deleted", "id": "org_123"}一般的なエラーのシナリオとその対応:
// 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"}ベストプラクティス
Section titled “ベストプラクティス”- 命名: 組織には明確でわかりやすい名前を使用します。
- 役割: チームメンバーに適切な役割を割り当てます。
- 電子メール: 個人の電子メール変更による問題を避けるために、management_email にはグループ電子メールを使用します。
- ロゴ: 信頼できる CDN でロゴをホストし、HTTPS URL を使用します。