部门更新¶
功能说明¶
更新部门
接口地址¶
- 测试环境: https://openapi.guanaitong.tech/department/update
- 生产环境: https://openapi.guanaitong.com/department/update
HTTP请求方式¶
- Method: POST
- Content-Type: application/x-www-form-urlencoded
参数说明¶
-
公有参数
发送请求是必须传入公共参数,详见公共参数
-
私有参数
| 参数名称 | 是否必须 | 参数类型 | 长度限制 | 描述 |
|---|---|---|---|---|
| enterprise_code | 否 | string | [1,20] | 企业编号(集团必填,企业无需填写) |
| dept_code | 是 | string | [1,50] | 部门编码 |
| new_dept_code | 否 | string | [1,50] | 新的部门编码 |
| name | 否 | string | [1,100] | 部门名称 |
| parent_code | 否 | string | [1,50] | 上级部门编码 |
| manager_userid | 否 | string | [0,20] | 部门主管第三方唯一标识 |
| status | 否 | int | [1] | 部门是否有效,1有效、2无效(该字段已废弃) |
请求示例(HTTP)¶
POST /department/update HTTP/1.1
Host: openapi.guanaitong.tech
Content-Type: application/x-www-form-urlencoded
Cache-Control: no-cache
access_token=6007bf4c6efeb798da35b843e4614cff&dept_code=S100&manager_code=HB200&name=部门测试&
timestamp=1501741860&parent_code=S000&status=1&sign=dc2cb643d101d8ae96e857ff4ca24de23bf4f27f
请求示例(JAVA SDK)¶
public class Main {
public static OpenClient openClient = new OpenClient(Constants.BASE_URL_TEST, "xxx", "xxx");
public static void main(String[] args) {
DepartmentUpdateRequest departmentUpdateRequest = new DepartmentUpdateRequest();
departmentUpdateRequest.setDeptCode("DEPT_0825_02");
departmentUpdateRequest.setName("DEPT_0825_02+01");
departmentUpdateRequest.setManagerUserid("tom082401");
String data = openClient.departmentApi().update(departmentUpdateRequest);
System.out.println(data);
}
}
返回参数说明¶
| 参数名称 | 描述 |
|---|---|
| code | 返回码。详见错误返回码。 |
| msg | 如果错误,返回错误信息。 |
| data | 如果没有错误,返回部门编号 |
正确返回示例¶
错误返回示例¶
常见错误码¶
| 错误码 | 错误信息 | 排查方法 |
|---|---|---|
| 1000220002 | 参数验证不通过 | 检测参数是否按要求填写 |
| 1000220010 | dept_code not exists ! | 检测部门是否成功添加 |
| 1000220011 | parent_code not exists ! | 检测父部门是否已添加 |
| 1002212003 | 部门添加或更新:名称已存在 | 企业同级部门名称不能重复 |
| 1002212010 | 部门编码已存在 | 企业部门编码唯一 |
| 1000240002 | enterprise_code校验失败 | 检查enterprise_code是否是已绑定的编码 |
| 1000220096 | 该用户ID对应员工不存在 | userid对应员工是否已添加 |
| 1000220019 | root department can't modify dept_name ! | 根部门不能变更名字 |
| 1000220020 | root department can't modify parent department ! | 根部门不能变更父部门 |
| 1000220021 | root department can't be invalid ! | 根部门不能无效效 |
| 1000220022 | root department not exists ! | 根部门不存在 |
| other | 其他公共错误码 | 其他公共错误码 |