Service-Account-Mitglied eines Workspace aktualisieren
POST/v1/organizations/workspaces/{workspace_id}/service_accounts/{service_account_id}
Erfordert ein OAuth-Zugriffstoken mit dem Scope org:admin, über ant auth login --scope org:admin oder eine Workload-Identity-Federation-Regel; Admin-API-Keys werden nicht akzeptiert. Siehe WIF mit der Admin API verwalten.
Ändert die Rolle eines Service-Accounts in einem Workspace.
Die neue workspace_role ersetzt die aktuelle. Nur explizite
Mitgliedschaften können aktualisiert werden; um eine Rolle für die implizite
Mitgliedschaft im Standard-Workspace festzulegen, füge den Service-Account explizit mit
POST /workspaces/{workspace_id}/service_accounts hinzu. Archivierte Workspaces
geben 400 zurück. Archivierte Service-Accounts können nicht aktualisiert werden und werden
abgelehnt.
Parameters
Returns
Service-Account-Mitglied eines Workspace aktualisieren
package com.anthropic.example;
import com.anthropic.client.AnthropicClient;
import com.anthropic.client.okhttp.AnthropicOkHttpClient;
import com.anthropic.models.beta.organization.serviceaccounts.BetaServiceAccountWorkspaceMember;
import com.anthropic.models.beta.organization.workspaces.BetaNoBillingWorkspaceRole;
import com.anthropic.models.beta.organization.workspaces.serviceaccounts.ServiceAccountUpdateParams;
public final class Main {
private Main() {}
public static void main(String[] args) {
AnthropicClient client = AnthropicOkHttpClient.fromEnv();
ServiceAccountUpdateParams params = ServiceAccountUpdateParams.builder()
.workspaceId("workspace_id")
.serviceAccountId("service_account_id")
.workspaceRole(BetaNoBillingWorkspaceRole.WORKSPACE_ADMIN)
.build();
BetaServiceAccountWorkspaceMember betaServiceAccountWorkspaceMember = client.beta().organization().workspaces().serviceAccounts().update(params);
}
}Response 200
{
"created_by_actor_id": "created_by_actor_id",
"implicit": true,
"service_account_id": "service_account_id",
"type": "service_account_workspace_member",
"workspace_id": "workspace_id",
"workspace_role": "workspace_admin"
}Returns Examples
Response 200
{
"created_by_actor_id": "created_by_actor_id",
"implicit": true,
"service_account_id": "service_account_id",
"type": "service_account_workspace_member",
"workspace_id": "workspace_id",
"workspace_role": "workspace_admin"
}