Obtenir un compte de service membre d'un espace de travail
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 workload identity federation (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.
Récupérez l'appartenance d'un compte de service à un espace de travail.
Renvoie l'enregistrement d'appartenance, y compris le workspace_role du compte de service
dans cet espace de travail. Les espaces de travail archivés renvoient 400. Pour
l'espace de travail par défaut, renvoie l'appartenance implicite (implicit: true)
lorsqu'aucune appartenance explicite n'existe ; une appartenance ajoutée
explicitement est renvoyée avec son rôle attribué. Un compte de service
archivé renvoie 404.
Parameters
Returns
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.serviceaccounts.ServiceAccountRetrieveParams;
public final class Main {
private Main() {}
public static void main(String[] args) {
AnthropicClient client = AnthropicOkHttpClient.fromEnv();
ServiceAccountRetrieveParams params = ServiceAccountRetrieveParams.builder()
.workspaceId("workspace_id")
.serviceAccountId("service_account_id")
.build();
BetaServiceAccountWorkspaceMember betaServiceAccountWorkspaceMember = client.beta().organization().workspaces().serviceAccounts().retrieve(params);
}
}{
"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
{
"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"
}