跳转至

获取员工所有扩展属性

功能说明

获取员工所有扩展属性

接口地址

HTTP请求方式

  • Method: POST
  • Content-Type: application/x-www-form-urlencoded

参数说明

  • 公有参数

    发送请求是必须传入公共参数,详见公共参数

  • 私有参数

参数名称 是否必须 参数类型 长度限制 描述
userid string [1,100] 员工第三方唯一标识,不会变更
enterprise_code string [1,20] 企业编码(集团必填,企业不填)

请求示例(HTTP)

POST /employee/attribute/get HTTP/1.1
Host: openapi.guanaitong.tech
Content-Type: application/x-www-form-urlencoded
Cache-Control: no-cache

access_token=a9574640d1030306d684706ecbf5d84f&userid=LOL001&
timestamp=1492671874&sign=b314c43d96345a364c65c982ef1c95ab55fa3482

请求示例(JAVA SDK)

public class Main {
    public static OpenClient openClient = new OpenClient(Constants.BASE_URL_TEST, "xxx", "xxx");
    public static void main(String[] args) {
        EmployeeAttributeGetRequest employeeAttributeGetRequest = new EmployeeAttributeGetRequest();
        employeeAttributeGetRequest.setUserId("tom0001");

        List<EmployeeAttributeGetResp> attributeGetRespList = openClient.employeeApi().getAttribute(employeeAttributeGetRequest);
        System.out.println(JSON.toJSONString(attributeGetRespList));
    }
}

返回参数说明

参数名称 描述
code 返回码。详见错误返回码
msg 如果错误,返回错误信息。
data 如果没有错误,返回业务数据
data.code 员工扩展属性code
data.name 员工扩展属性中文名
data.value 员工扩展属性值,为null或空串表示未设置该属性

正确返回示例

{
    "code": 0,
    "data": [{
            "code": "englishName",
            "name": "英文姓名",
            "value": null
        }, {
            "code": "politicalVisage",
            "name": "政治面貌",
            "value": null
        }, {
            "code": "maritalStatus",
            "name": "婚姻状况"
        }, {
            "code": "memberCategory",
            "name": "员工分类",
            "value": ["党员", "已婚"]
        }
    ],
    "msg": "OK"
}

错误返回示例

{
    "code": 1000220096,
    "data": null,
    "msg": "该用户ID对应员工不存在"
}

常见错误码

错误码 错误信息 排查方法
1000220002 参数验证不通过 检测参数是否按要求填写
1000220096 该用户ID对应员工不存在 userid对应员工是否已添加
1000220102 员工不存在 userid对应员工是否已添加
1000240002 enterprise_code校验失败 检查enterprise_code是否是已绑定的编码
other 其他公共错误码 其他公共错误码
回到页面顶部