¶ 部门下添加成员
更新时间: 2025-08-20 12:33:28
通过部门 ID、组织 code,添加部门下成员。
¶ 请求参数
| 名称 | 类型 | 必填 | 默认值 | 描述 | 示例值 | 
|---|---|---|---|---|---|
| userIds | string[] | 是 | - | 用户 ID 列表。 | ["623c20b2a062aaaaf41b17da"] | 
| organizationCode | string | 是 | - | 组织 code。 | steamory | 
| departmentId | string | 是 | - | 部门系统 ID(为 Authing 系统自动生成,不可修改)。 | 60b49eb83fd80adb96f26e68 | 
| departmentIdType | string | 否 | department_id | 此次调用中使用的部门 ID 的类型。 枚举值: department_id,open_department_id | department_id | 
¶ 示例代码
import { ManagementClient } from 'authing-node-sdk';
// 在 Node.js 中引用:
// const { ManagementClient } = require('authing-node-sdk');
const managementClient = new ManagementClient({
  accessKeyId: 'AUTHING_USERPOOL_ID',
  accessKeySecret: 'AUTHING_USERPOOL_SECRET',
});
(async () => {
  const result = await managementClient.addDepartmentMembers({
    departmentId: '60b49eb83fd80adb96f26e68',
    organizationCode: 'steamory',
    departmentIdType: 'department_id',
    userIds: ["623c20b2a062aaaaf41b17da"],
 });
})();
¶ 请求响应
类型: IsSuccessRespDto
| 名称 | 类型 | 描述 | 
|---|---|---|
| statusCode | number | 业务状态码,可以通过此状态码判断操作是否成功,200 表示成功。 | 
| message | string | 描述信息 | 
| apiCode | number | 细分错误码,可通过此错误码得到具体的错误类型。 | 
| data | IsSuccessDto | 操作是否成功 | 
示例结果:
{
  "statusCode": 200,
  "message": "操作成功",
  "apiCode": 20001,
  "data": {
    "success": true
  }
}
¶ 数据结构
¶ IsSuccessDto
| 名称 | 类型 | 必填 | 描述 | 
|---|---|---|---|
| success | boolean | 是 | 操作是否成功。 示例值: true |