移除成员

更新时间:
复制 MD 格式

移除组织成员;移除前会检查成员是否持有席位,持有席位时拒绝移除。

前提条件

已获取阿里云账号或 RAM 用户的 AccessKey,并已为其授予调用本接口所需的 RAM 权限。建议将 AccessKey 配置为环境变量 ALIBABA_CLOUD_ACCESS_KEY_ID 和 ALIBABA_CLOUD_ACCESS_KEY_SECRET,避免明文写入代码。

接口

POST/tokenplan/organization/member-removals

本接口是阿里云 OpenAPI,采用 AccessKey 签名(签名算法 ACS3-HMAC-SHA256),不支持 Authorization: Bearer {API_KEY} 方式。请求需携带公共请求头 x-acs-action: RemoveOrganizationMember、x-acs-version: 2026-02-10、x-acs-date、x-acs-content-sha256、x-acs-signature-nonce 以及 Authorization。

推荐使用阿里云 SDK 或 OpenAPI Explorer 发起调用,可免去自行计算签名。详细说明见认证。

请求参数

所有参数均通过 Query String 传递。数组类型参数(AccountIds)使用 Flat 格式:以 参数名.序号 逐个传递,序号从 1 开始,例如 AccountIds.1=acc_123456789、AccountIds.2=<第二个取值>。

AccountIdsArray可选

被移除的成员账号 ID 列表

Localestring可选

多语言信息 zh-CN/en-US

返回参数

Successboolean

是否成功

Codestring

错误码(成功时为空)

Messagestring

错误信息(成功时为空)

请求示例

本接口使用阿里云 OpenAPI 签名,下例中 ${SIGNATURE} 需按 ACS3-HMAC-SHA256 算法计算得出,x-acs-date、x-acs-signature-nonce 需替换为实际值。

curl -X POST "https://modelstudio.cn-beijing.aliyuncs.com/tokenplan/organization/member-removals?AccountIds.1=acc_123456789&Locale=zh-CN" \
    --header "x-acs-action: RemoveOrganizationMember" \
    --header "x-acs-version: 2026-02-10" \
    --header "x-acs-date: 2026-01-01T12:00:00Z" \
    --header "x-acs-content-sha256: e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" \
    --header "x-acs-signature-nonce: ${SIGNATURE_NONCE}" \
    --header "Authorization: ACS3-HMAC-SHA256 Credential=${ALIBABA_CLOUD_ACCESS_KEY_ID},SignedHeaders=host;x-acs-action;x-acs-content-sha256;x-acs-date;x-acs-signature-nonce;x-acs-version,Signature=${SIGNATURE}"
import os

from alibabacloud_modelstudio20260210.client import Client
from alibabacloud_modelstudio20260210 import models
from alibabacloud_tea_openapi import models as open_api_models

config = open_api_models.Config(
    access_key_id=os.environ["ALIBABA_CLOUD_ACCESS_KEY_ID"],
    access_key_secret=os.environ["ALIBABA_CLOUD_ACCESS_KEY_SECRET"],
    endpoint="modelstudio.cn-beijing.aliyuncs.com",
)
client = Client(config)

request = models.RemoveOrganizationMemberRequest(
    account_ids=["acc_123456789"],
    locale="zh-CN",
)
response = client.remove_organization_member(request)
print(response.body)
import java.util.Arrays;

import com.aliyun.auth.credentials.Credential;
import com.aliyun.auth.credentials.provider.StaticCredentialProvider;
import com.aliyun.sdk.service.modelstudio20260210.AsyncClient;
import com.aliyun.sdk.service.modelstudio20260210.DefaultAsyncClientBuilder;
import com.aliyun.sdk.service.modelstudio20260210.models.RemoveOrganizationMemberRequest;
import com.aliyun.sdk.service.modelstudio20260210.models.RemoveOrganizationMemberResponse;

public class RemoveOrganizationMember {
    public static void main(String[] args) throws Exception {
        StaticCredentialProvider provider = StaticCredentialProvider.create(Credential.builder()
            .accessKeyId(System.getenv("ALIBABA_CLOUD_ACCESS_KEY_ID"))
            .accessKeySecret(System.getenv("ALIBABA_CLOUD_ACCESS_KEY_SECRET"))
            .build());
        AsyncClient client = new DefaultAsyncClientBuilder()
            .credentialsProvider(provider)
            .region("cn-beijing")
            .build();

        RemoveOrganizationMemberRequest request = RemoveOrganizationMemberRequest.builder()
            .accountIds(Arrays.asList("acc_123456789"))
            .locale("zh-CN")
            .build();
        RemoveOrganizationMemberResponse response = client.removeOrganizationMember(request).get();
        System.out.println(response.getBody());
        client.close();
    }
}

返回示例

{
  "Success": true
}

错误码

如果调用失败,会返回错误信息。更多错误码及解决方法,请参见Token Plan API 错误码。