Aggiungi workspace al service account
POST/v1/organizations/service_accounts/{service_account_id}/workspaces
Richiede un token di accesso OAuth con lo scope org:admin, ottenuto da ant auth login --scope org:admin o da una regola di workload identity federation; le chiavi Admin API non sono accettate. Consulta Gestisci WIF con l'Admin API.
Aggiungi un account di servizio a un workspace con il workspace_role indicato.
Speculare a POST /workspaces/{workspace_id}/service_accounts, indirizzato
dal lato dell'account di servizio; entrambi creano la stessa appartenenza. Se
l'account di servizio è già membro esplicito del workspace, il suo
workspace_role viene sostituito con il valore fornito qui. I workspace
archiviati restituiscono 400. Gli account di servizio archiviati non possono essere aggiunti e vengono
rifiutati.
Parameters
Returns
Aggiungi workspace al service account
<?php
require_once dirname(__DIR__) . '/vendor/autoload.php';
$client = new Client(apiKey: 'my-anthropic-api-key');
$betaServiceAccountWorkspaceMember = $client
->beta
->organization
->serviceAccounts
->workspaces
->add(
'service_account_id',
workspaceID: 'workspace_id',
workspaceRole: NoBillingWorkspaceRole::WORKSPACE_ADMIN,
betas: [AnthropicBeta::MESSAGE_BATCHES_2024_09_24],
);
var_dump($betaServiceAccountWorkspaceMember);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"
}