Claude Platform Docs

Ajouter un espace de travail à une règle de fédération

$client->beta->organization->federation->rules->workspaces->add(string federationRuleID, string workspaceID, ?list<AnthropicBeta> betas): BetaFederationRuleWorkspace
POST/v1/organizations/federation_rules/{federation_rule_id}/workspaces

Nécessite un jeton d'accès OAuth avec la portée org:admin, obtenu via ant auth login --scope org:admin ou une règle de fédération d'identité de charge de travail ; les clés Admin API ne sont pas acceptées. Consultez Gérer WIF avec l'Admin API.

Activez une règle de fédération pour un espace de travail.

Idempotent ; une nouvelle activation renvoie l'activation existante. La règle et l'espace de travail doivent tous deux appartenir à votre organisation. L'appartenance du compte de service cible de la règle à cet espace de travail n'est pas vérifiée lors de l'activation : l'échange de jetons vers cet espace de travail est rejeté sauf si la cible en est membre (elle est implicitement membre de l'espace de travail par défaut). Les règles archivées sont rejetées avec une erreur 400. Les appelants OAuth ne peuvent gérer que les règles dont oauth_scope vaut workspace:developer ou workspace:inference ; les autres portées nécessitent une session Console.

Parameters
federationRuleID: string

ID of the federation rule.

workspaceID: string

Tagged ID of the workspace to enable this rule for.

betas?:optional list<AnthropicBeta>

Optional header to specify the beta version(s) you want to use.

Returns
class BetaFederationRuleWorkspace { $type = 'federation_rule_workspace'; $createdAt; $createdByActorID; /* 3 more */ }
"federation_rule_workspace" type
\Datetime createdAt

When this workspace was enabled for the rule.

?string createdByActorID

Tagged ID (user_... or svac_...) of the actor that enabled this workspace for the rule, if known.

string federationRuleID

Tagged ID of the federation rule.

string workspaceID

Tagged ID of the workspace this rule is enabled for.

?string workspaceName

Workspace display name. Populated when listing; null in the enable response.

Ajouter un espace de travail à une règle de fédération
<?php

require_once dirname(__DIR__) . '/vendor/autoload.php';

$client = new Client(apiKey: 'my-anthropic-api-key');

$betaFederationRuleWorkspace = $client
  ->beta
  ->organization
  ->federation
  ->rules
  ->workspaces
  ->add(
  'federation_rule_id',
  workspaceID: 'workspace_id',
  betas: [AnthropicBeta::MESSAGE_BATCHES_2024_09_24],
);

var_dump($betaFederationRuleWorkspace);
Returns Examples
Response 200
{
  "created_at": "2024-10-30T23:58:27.427722Z",
  "created_by_actor_id": "created_by_actor_id",
  "federation_rule_id": "federation_rule_id",
  "type": "federation_rule_workspace",
  "workspace_id": "workspace_id",
  "workspace_name": "workspace_name"
}