获取服务账号工作区成员
GET/v1/organizations/workspaces/{workspace_id}/service_accounts/{service_account_id}
需要具有 org:admin 作用域的 OAuth 访问令牌,可通过 ant auth login --scope org:admin 或工作负载身份联合规则获取;不接受 Admin API 密钥。请参阅使用 Admin API 管理 WIF。
检索服务账号在工作区中的成员资格。
返回成员资格记录,包括服务账号在此工作区中的 workspace_role。已归档的工作区将返回 400。对于默认工作区,如果不存在显式成员资格,则返回隐式(implicit: true)成员资格;显式添加的成员资格将连同其分配的角色一起返回。已归档的服务账号将返回 404。
Parameters
Returns
获取服务账号工作区成员
package com.anthropic.example;
import com.anthropic.client.AnthropicClient;
import com.anthropic.client.okhttp.AnthropicOkHttpClient;
import com.anthropic.models.organization.serviceaccounts.ServiceAccountWorkspaceMember;
import com.anthropic.models.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();
ServiceAccountWorkspaceMember serviceAccountWorkspaceMember = client.organization().workspaces().serviceAccounts().retrieve(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"
}