修改成员角色

更新时间:
复制 MD 格式

修改组织成员的角色。

前提条件

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

接口

POST/tokenplan/organization/members/update

本接口是阿里云 OpenAPI,采用 AccessKey 签名(签名算法 ACS3-HMAC-SHA256),不支持 Authorization: Bearer {API_KEY} 方式。请求需携带公共请求头 x-acs-action: UpdateOrganizationMember、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 列表(批量操作)

NewRoleCodestring必填

新角色 Code(批量操作时所有账号统一变更为此角色)

返回参数

Successboolean

是否成功

Codestring

错误码(成功时为空)

Messagestring

错误信息(成功时为空)

HttpStatusCodeinteger

HTTP 状态码

RequestIdstring

请求唯一标识

请求示例

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

curl -X POST "https://modelstudio.cn-beijing.aliyuncs.com/tokenplan/organization/members/update?AccountIds.1=acc_123456789&NewRoleCode=ORG_MEMBER" \
    --header "x-acs-action: UpdateOrganizationMember" \
    --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.UpdateOrganizationMemberRequest(
    account_ids=["acc_123456789"],
    new_role_code="ORG_MEMBER",
)
response = client.update_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.UpdateOrganizationMemberRequest;
import com.aliyun.sdk.service.modelstudio20260210.models.UpdateOrganizationMemberResponse;

public class UpdateOrganizationMember {
    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();

        UpdateOrganizationMemberRequest request = UpdateOrganizationMemberRequest.builder()
            .accountIds(Arrays.asList("acc_123456789"))
            .newRoleCode("ORG_MEMBER")
            .build();
        UpdateOrganizationMemberResponse response = client.updateOrganizationMember(request).get();
        System.out.println(response.getBody());
        client.close();
    }
}

返回示例

{
  "Success": true
}

错误码

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