Request
| Basic information | |
|---|---|
| HTTP URL | https://api.dingtalk.io/topapi/attendance/shift/history/query |
| HTTP Method | POST |
| Supported app types | appType-Internal app |
| Permissions | permission-qyapi_attendance_group_read-Attendance group query permission |
Query Parameters
| Name | Type | Required | Example | Description |
|---|---|---|---|---|
| access_token | String | Yes | 73e9xxx | The app credential used to call this API. Obtain it by calling the Get the access_token of an Internal App API. |
Request Body
| Name | Type | Required | Example | Description |
|---|---|---|---|---|
| op_user_id | String | Yes | user123 | The userId of the operator. |
| shift_id | Number | Yes | 628380875 | The shift ID. Obtain the id value by calling the Get Shift Summaries API. |
| version | Number | Yes | 624190327 | The shift version. Obtain the shift_version value by calling the Batch Query User Scheduling Information API. |
Request Example
curl -X POST "https://api.dingtalk.io/topapi/attendance/shift/history/query" \
-H 'Content-Type:application/x-www-form-urlencoded;charset=utf-8' \
-d 'access_token=e56f7xxxxeb7ef1' \
-d 'op_user_id=dd_dd' \
-d 'shift_id=2445' \
-d 'version=222'
DingTalkClient client = new DefaultDingTalkClient("https://api.dingtalk.io/topapi/attendance/shift/history/query");
OapiAttendanceShiftHistoryQueryRequest req = new OapiAttendanceShiftHistoryQueryRequest();
req.setOpUserId("user456");
req.setShiftId(715390132L);
req.setVersion(624190327L);
OapiAttendanceShiftHistoryQueryResponse rsp = client.execute(req, access_token);
System.out.println(rsp.getBody());
import dingtalk.api
req=dingtalk.api.OapiAttendanceShiftHistoryQueryRequest("https://api.dingtalk.io/topapi/attendance/shift/history/query")
req.op_user_id="dd_dd"
req.shift_id=2445
req.version=222
try:
resp= req.getResponse(access_token)
print(resp)
except Exception,e:
print(e)
include "TopSdk.php";
date_default_timezone_set('Asia/Shanghai');
$c = new DingTalkClient(DingTalkConstant::$CALL_TYPE_OAPI, DingTalkConstant::$METHOD_POST , DingTalkConstant::$FORMAT_JSON);
$req = new OapiAttendanceShiftHistoryQueryRequest;
$req->setOpUserId("dd_dd");
$req->setShiftId("2445");
$req->setVersion("222");
$resp = $c->execute($req, $access_token, "https://api.dingtalk.io/topapi/attendance/shift/history/query");
IDingTalkClient client = new DefaultDingTalkClient("https://api.dingtalk.io/topapi/attendance/shift/history/query");
OapiAttendanceShiftHistoryQueryRequest req = new OapiAttendanceShiftHistoryQueryRequest();
req.OpUserId = "dd_dd";
req.ShiftId = 2445L;
req.Version = 222L;
OapiAttendanceShiftHistoryQueryResponse rsp = client.Execute(req, access_token);
Console.WriteLine(rsp.Body);
Response
Response Body
| Name | Type | Example | Description |
|---|---|---|---|
| result | TopShiftVo | The query result. | |
| shift_group_name | String | Regular day shift | The shift group name. |
| corp_id | String | dinge87fxxx | The organization ID (corpId). |
| shift_setting | TopShiftSettingVo | The shift settings. | |
| shift_id | Number | 628380875 | The shift ID. |
| gmt_modified | Date | 2021-01-14 14:21:03 | The time when the shift was last modified. |
| corp_id | String | dinge87fxxx | The organization ID (corpId). |
| is_deleted | String | N | The deletion flag. |
| work_time_minutes | Number | 480 | The work duration, in minutes. A value of -1 indicates that this feature is disabled. |
| id | Number | 350530359 | The shift settings ID. Currently not used. |
| attend_days | String | 21 | The number of attendance days for this shift. |
| gmt_create | Date | 2021-01-14 14:18:08 | The creation time. |
| name | String | Regular day shift | The shift name. |
| id | Number | 241120079 | The shift ID. |
| sections | TopSectionVo[] | The clock-in sections. | |
| punches | TopPunchVo[] | The clock-in points. | |
| check_type | String | OnDuty | The clock-in type: - OnDuty: Clock in - OffDuty: Clock out |
| end_min | Number | 1 | The latest allowed delay for clock-in, in minutes. |
| across | Number | 0 | Whether the shift spans to the next day: - 0: Does not span to the next day - 1: Spans to the next day |
| check_time | Date | 1970-01-01 09:00:00 | The clock-in time. |
| permit_minutes | Number | 60 | The allowed duration for late arrival or early leave. |
| free_check | Boolean | false | Whether clock-in is exempt: - true: Clock-in not required - false: Clock-in required |
| id | Number | 376955859 | The clock-in point ID. Currently not used. |
| begin_min | Number | demo | The earliest allowed advance for clock-in, in minutes. |
| work_time_minutes | Number | 480 | The work duration, in minutes. |
| rests | TopRestVo[] | The break sections. | |
| check_type | String | OnDuty | The break type: - OnDuty: Break start - OffDuty: Break end |
| across | Number | 0 | Whether the break spans to the next day, meaning the break time falls on the following day: - 0: Does not span to the next day - 1: Spans to the next day |
| check_time | Date | 1970-01-01 12:00:00 | The break time. |
| id | Number | 376955861 | The break point ID. |
| id | Number | 22979360 | The clock-in section ID. Each clock-in and clock-out pair forms one section. A shift can have multiple sections. |
| shift_group_id | Number | 22979 | The shift group ID. |
| success | Boolean | true | Whether the call succeeded. - true: Success - false: Failed |
| errcode | Number | 0 | The return code. |
| errmsg | String | ok | The description of the return code. |
| request_id | String | q3ef3y3sogkd | The request ID. |
Response Body Example
{
"errcode": 0,
"errmsg":"ok",
"result": {
"corp_id": "dinge87fxxx",
"id": 628380875,
"name": "Regular day shift",
"sections": [
{
"id": 350530359,
"punches": [
{
"across": 0,
"begin_min": 1,
"check_time": "1970-01-01 09:00:00",
"check_type": "OnDuty",
"end_min": 1,
"free_check": false,
"id": 376955859,
"permit_minutes": 60
},
{
"across": 0,
"begin_min": 1,
"check_time": "1970-01-01 18:00:00",
"check_type": "OffDuty",
"end_min": 1,
"free_check": false,
"id": 376955860,
"permit_minutes": 15
}
],
"rests": [
{
"across": 0,
"check_time": "1970-01-01 12:00:00",
"check_type": "OnDuty",
"id": 376955861
},
{
"across": 0,
"check_time": "1970-01-01 13:00:00",
"check_type": "OffDuty",
"id": 376955862
}
]
}
],
"shift_setting": {
"corp_id": "dinge87fxxx",
"gmt_create": "2021-01-14 14:18:08",
"gmt_modified": "2021-01-14 14:21:03",
"id": 624190327,
"is_deleted": "N",
"shift_id": 628380875,
"work_time_minutes": 480
}
},
"success": true,
"request_id": "q3ef3y3sogkd"
}