这篇文档是用中文书写的,由于作者能力有限,英文文档可能存在一些表述不清的地方,使用者可以即时与我们讨论,避免误解。
[中]

Instruction:

  • Employee Information Acquisition Interface

Provide the following two ways to obtain:

  1. Using official interface of enterprise Wechat: simpler and more restrictive

  2. Using self-built system: It is more load-intensive and scalable, but requires the corresponding development capabilities of the client side.

Mode 1: Enterprise Wechat Interface

version:

Number Maker Setting date Revision date
0.1 王鹤 2018-12-18

Step 1: Get enterprise access_token

After obtaining the permanent authorization code of the enterprise, we will obtain access_token of the enterprise through this interface.

request URL:
Request method:
  • POST
OBJECT parameter description:
Parameter Required Description
corpid Yes enterprise ID
corpsecret Yes Application credential key
Sample code:

correct:

{
   "errcode":0"errmsg":"""access_token": "accesstoken000001",
   "expires_in": 7200
}

error:

{
   "errcode":40091,
   "errmsg":"secret is invalid"
}
CALLBACK return parameter::
Parameter Description
access_token Obtained credentials, up to 512 bytes
expires_in expire time
Remarks:
  • We will cache this access_token and retrieve it when it expires.

Step 2: Get the list of members (executed manually)

This API is used to obtain the list of all members in the department. In order to avoid abuse of authority, we should restrict our account to obtain the address book information of authorized department. At the same time, in order to avoid frequent requests for data, this step is not recommended to be automatically executed. (In actual use, the increase or decrease of personnel will not be too frequent). The operation of obtaining the list of members should be performed manually in the background after each change of personnel.

For new personnel, the next operation will be triggered automatically, and for deleted personnel, they will be left automatically.

request URL:
Request method:
  • GET
OBJECT parameter description:
Parameter Required Description
access_token Yes
department_id Yes
fetch_child No 1/0:Whether to recursively retrieve members under subdivisions
Sample code:

correct:

{
   "errcode": 0,
   "errmsg": "ok",
   "userlist": [
           {
                  "userid": "zhangsan",
                  "name": "李四",
                  "department": [1, 2]
           }
     ]
}
CALLBACK return parameter::
Parameter Description
errcode errcode
errmsg message
userlist
Worknumber Employee number
name
department
Remarks:
  • The above data are for reference only. Specific fields will be adjusted according to actual business.

Step 3: Get member details

This operation is used to obtain members’detailed information. It will automatically acquire all members’ information in the form of timed tasks, tentatively at 3:00 a.m. per day. The system automatically updates all members’information. This operation also supports manual refresh.

request URL:
Request method:
  • GET
OBJECT parameter description:
Parameter Required Description
access_token Yes
userid Yes Worknumber
Sample code:

correct:

{
    "errcode": 0,
    "errmsg": "ok",
    "Worknumber": "W20078277",
    "username": "李四",
    "phone": "13752299015",
    "department": [1, 2],
    "avatarUrl": null,
    "batch": "SH 20181015"
    "counter": "Tianjin Hisense",
    "createtime": "1539159953",
    "date": "2018-10-15",
    "nickName": 小四,
    "openid": null,
}
CALLBACK return parameter::
Parameter Description
errcode errcode
errmsg errmsg
Worknumber Employee number
username
phone
department
avatarUrl
batch
counter
createtime
date
nickName WeChat nickName
openid WeChat openid
Remarks:
  • The above data are for reference only. Specific fields will be adjusted according to actual business.

Mode 2: Self-built HR system

Similar to the Wechat interface, but the specific interface, parameters, or standard interface provided by the client, we call directly to obtain.

文档更新时间: 2018-12-28 17:01   作者:admin