Request
| Basic Information | |
|---|---|
| HTTP URL | https://api.dingtalk.io/topapi/attendance/schedule/listbyusers |
| HTTP Method | POST |
| Supported app types | appType-Internal app appType-Third-party enterprise app |
| Required permissions | qyapi_attendance_group_read: Attendance group query permission |
Query Parameters
| Name | Type | Required | Example | Description |
|---|---|---|---|---|
| access_token | String | Yes | bE74xxxx | The App credential used to call this API. - For an Internal app, obtain it by calling Get the access_token of an Internal App. - For a Third-party enterprise app, obtain it by calling the API that gets the access_token of a third-party organization. |
Request Body
| Name | Type | Required | Example | Description |
|---|---|---|---|---|
| op_user_id | String | Yes | user456 | The user ID of the operator. |
| userids | String | Yes | user123 | The list of user IDs to query. Separate multiple user IDs with commas. Pass up to 50 user IDs at a time. |
| from_date_time | Number | Yes | 1565591096000 | The start date, as a Unix timestamp in milliseconds. Note - The interval between the start time and the end time cannot exceed 7 days. - The query time must be within the last 180 days. |
| to_date_time | Number | Yes | 1565591096000 | The end date, as a Unix timestamp in milliseconds. Note - The interval between the start time and the end time cannot exceed 7 days. - The query time must be within the last 180 days. |
Request Example
curl -X POST "https://api.dingtalk.io/topapi/attendance/schedule/listbyusers" \
-H 'Content-Type:application/x-www-form-urlencoded;charset=utf-8' \
-d 'access_token=9ad3xxxx82a10' \
-d 'from_date_time=1565591096000' \
-d 'op_user_id=dd_dd' \
-d 'to_date_time=1565591096000' \
-d 'userids=dd_dd%2Cduogui'
DingTalkClient client = new DefaultDingTalkClient("https://api.dingtalk.io/topapi/attendance/schedule/listbyusers");
OapiAttendanceScheduleListbyusersRequest req = new OapiAttendanceScheduleListbyusersRequest();
req.setOpUserId("user456");
req.setUserids("user123,user456");
req.setFromDateTime(1565591096000L);
req.setToDateTime(1565591096000L);
OapiAttendanceScheduleListbyusersResponse rsp = client.execute(req, access_token);
System.out.println(rsp.getBody());
import dingtalk.api
req=dingtalk.api.OapiAttendanceScheduleListbyusersRequest("https://api.dingtalk.io/topapi/attendance/schedule/listbyusers")
req.op_user_id="dd_dd"
req.userids="dd_dd,duogui"
req.from_date_time=1565591096000
req.to_date_time=1565591096000
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 OapiAttendanceScheduleListbyusersRequest;
$req->setOpUserId("dd_dd");
$req->setUserids("dd_dd,duogui");
$req->setFromDateTime("1565591096000");
$req->setToDateTime("1565591096000");
$resp = $c->execute($req, $access_token, "https://api.dingtalk.io/topapi/attendance/schedule/listbyusers");
IDingTalkClient client = new DefaultDingTalkClient("https://api.dingtalk.io/topapi/attendance/schedule/listbyusers");
OapiAttendanceScheduleListbyusersRequest req = new OapiAttendanceScheduleListbyusersRequest();
req.OpUserId = "dd_dd";
req.Userids = "dd_dd,duogui";
req.FromDateTime = 1565591096000L;
req.ToDateTime = 1565591096000L;
OapiAttendanceScheduleListbyusersResponse rsp = client.Execute(req, access_token);
Console.WriteLine(rsp.Body);
Response
Response Body
| Name | Type | Example | Description |
|---|---|---|---|
| result | TopScheduleVo[] | demo | The query result. |
| check_type | String | OnDuty | The attendance type: - Onduty: Clock-in at the start of work - OffDuty: Clock-out at the end of work |
| plan_check_time | Date | 2021-01-14 09:00:00 | The scheduled clock-in time. |
| group_id | Number | 394775001 | The attendance group ID. |
| userid | String | user456 | The user ID. |
| approve_id | Number | 1234 | The ID of the Approval form bound to the schedule. Note This field is not returned if no Approval form exists for the day. |
| work_date | Date | 2021-01-14 00:00:00 | The workday, indicating the specific day of the schedule. |
| id | Number | 56676915454 | The schedule ID. |
| shift_version | Number | 588655171 | The shift version. |
| shift_id | Number | 677995086 | The shift ID. A value of 0 indicates a day off. |
| is_rest | String | N | Indicates whether the day is a day off: - Y: The day is scheduled as a day off - N: The day is not a day off |
| success | Boolean | true | Indicates whether the request succeeded. - true: Success - false: Failed |
| errcode | Number | 0 | The return code. |
| errmsg | String | ok | The return message. |
| request_id | String | qkqbwcw3bq2 | The request ID. |
Response Body Example
{
"errcode": 0,
"errmsg":"ok",
"result": [
{
"check_type": "OnDuty",
"group_id": 394775001,
"id": 56676915454,
"is_rest": "N",
"plan_check_time": "2021-01-14 09:00:00",
"shift_id": 709595172,
"shift_version": 617320362,
"userid": "user456",
"work_date": "2021-01-14 00:00:00"
},
{
"check_type": "OffDuty",
"group_id": 394775001,
"id": 56676915454,
"is_rest": "N",
"plan_check_time": "2021-01-14 18:00:00",
"shift_id": 709595172,
"shift_version": 617320362,
"userid": "user456",
"work_date": "2021-01-14 00:00:00"
}
],
"success": true,
"request_id": "4cmy9twx4atn"
}