Remove User

不登录 Application Portal 的状态下把一个用户移出一个组织。如果用户仅属于一个组织,移除后该用户与相关的用户数据(包括用户账号名和注册邮箱)将会被永久删除。

操作权限

需要在 Application Portal 给应用授权“在本 OU 创建或删除用户账号”的权限。

请求格式

POST https://{apigw-address}/app-portal-service/v2.2/user/remove

请求参数(Body)

名称 必需/可选 数据类型 描述
userId 必需 String 用户名。
organizationId 必需 String 组织 ID。如何获取 organizationId 信息>>

响应参数

名称 数据类型 描述
data Boolean true 表示移除成功,false 表示移除失败。

错误码

代码 描述
31400 参数错误,参数不能为空等
31403 应用未被授权“在本 OU 创建或删除用户账号”的权限
31404 未找到组织、用户等

示例

请求示例

url: https://{apigw-address}/app-portal-service/v2.2/user/remove

method: POST

requestBody:
{"userId":"yourUserId", "organizationId":"yourOrgId"}

返回示例

{
  "code": 0,
  "message": "OK",
  "data": true
}

Java SDK 调用示例

public class AppPortalSdkTest{
    @Test
    public void removeUser() {
        UserRemoveRequest userRemoveRequest = new UserRemoveRequest("your_user_id", "your_org_id");
        UserRemoveResponse userRemoveResponse = Poseidon.config(PConfig.init().appKey("your_access_key").appSecret("your_secret_key").debug())
                .url("https://{apigw-address}").getResponse(userRemoveRequest, UserRemoveResponse.class);

        System.out.println("List organization res: " + JSON.toJSONString(userRemoveResponse));

        assertNotNull("Response should not be null", userRemoveResponse);
        assertNotNull("Response data should not be null", userRemoveResponse.data);
    }
}