Request
| Basic Information | |
|---|---|
| HTTP URL | https://api.dingtalk.io/topapi/attendance/group/schedule/async |
| HTTP Method | POST |
| Supported app types | appType-Internal app appType-Third-party enterprise app |
| Required permissions | permission-qyapi_attendance_group_manage-Attendance group management 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, call the Get the access_token of an Internal App API to obtain it. - For a Third-party enterprise app, call the API for getting the access_token of a third-party organization to obtain it. |
Request Body
| Name | Type | Required | Example | Description |
|---|---|---|---|---|
| op_user_id | String | Yes | user456 | The user ID of the operator. |
| group_id | Number | Yes | 2987 | The attendance group ID. Note If you use the legacy attendance group identifier group_key, call the Convert groupKey to groupId API to convert group_key to group_id. |
| schedules | TopScheduleParam[] | Yes | The scheduling details. Example: { "is_rest": false, "work_date": 1605150671000, "shift_id": 1, "userid": "user123" } Note The maximum list length is 200. | |
| shift_id | Number | Yes | 1 | The shift ID. Pass 1 for a rest shift. Call the Get Shift Summaries API to obtain the id value. Note - When is_rest is true, pass 1 for shift_id. - To clear the schedule, pass -2 for shift_id. |
| work_date | Number | Yes | 1564985177000 | The scheduling date. Note The date must be no earlier than 180 days ago and no later than 180 days from now. |
| is_rest | Boolean | No | false | Specifies whether the day is a rest day: - true: Rest day Note When this parameter is true, pass 1 for shift_id. - false: Not a rest day |
| userid | String | Yes | user123 | The user ID of the user. |
Request Example
curl -X POST "https://api.dingtalk.io/topapi/attendance/group/schedule/async" \
-H 'Content-Type:application/x-www-form-urlencoded;charset=utf-8' \
-d 'access_token=d64b3xxxx57b23' \
-d 'group_id=2987' \
-d 'op_user_id=dd_test' \
-d 'schedules=null'
DingTalkClient client = new DefaultDingTalkClient("https://api.dingtalk.io/topapi/attendance/group/schedule/async");
OapiAttendanceGroupScheduleAsyncRequest req = new OapiAttendanceGroupScheduleAsyncRequest();
req.setOpUserId("user456");
req.setGroupId(2987L);
List<TopScheduleParam> list2 = new ArrayList<TopScheduleParam>();
TopScheduleParam obj3 = new TopScheduleParam();
obj3.setShiftId(1L);
obj3.setWorkDate(1564985177000L);
obj3.setIsRest(false);
obj3.setUserid("user123");
list2.add(obj3);
req.setSchedules(list2);
OapiAttendanceGroupScheduleAsyncResponse rsp = client.execute(req, access_token);
System.out.println(rsp.getBody());
import dingtalk.api
req=dingtalk.api.OapiAttendanceGroupScheduleAsyncRequest("https://api.dingtalk.io/topapi/attendance/group/schedule/async")
req.op_user_id="dd_test"
req.group_id=2987
req.schedules=""
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 OapiAttendanceGroupScheduleAsyncRequest;
$req->setOpUserId("dd_test");
$req->setGroupId("2987");
$schedules = new TopScheduleParam;
$schedules->shift_id="1";
$schedules->work_date="1564985177000";
$schedules->is_rest="false";
$schedules->userid="dd_test";
$req->setSchedules(array($schedules));
$resp = $c->execute($req, $access_token, "https://api.dingtalk.io/topapi/attendance/group/schedule/async");
IDingTalkClient client = new DefaultDingTalkClient("https://api.dingtalk.io/topapi/attendance/group/schedule/async");
OapiAttendanceGroupScheduleAsyncRequest req = new OapiAttendanceGroupScheduleAsyncRequest();
req.OpUserId = "dd_test";
req.GroupId = 2987L;
List<OapiAttendanceGroupScheduleAsyncRequest.TopScheduleParamDomain> list2 = new List<OapiAttendanceGroupScheduleAsyncRequest.TopScheduleParamDomain>();
OapiAttendanceGroupScheduleAsyncRequest.TopScheduleParamDomain obj3 = new OapiAttendanceGroupScheduleAsyncRequest.TopScheduleParamDomain();
list2.Add(obj3);
obj3.ShiftId = 1L;
obj3.WorkDate = 1564985177000L;
obj3.IsRest = false;
obj3.Userid = "dd_test";
req.Schedules_ = list2;
OapiAttendanceGroupScheduleAsyncResponse rsp = client.Execute(req, access_token);
Console.WriteLine(rsp.Body);
Response
Response Body
| Name | Type | Example | Description |
|---|---|---|---|
| success | Boolean | true | Indicates whether the request succeeded. - true: Success - false: Failed |
| errcode | Number | 0 | The return code. |
| errmsg | String | ok | The description of the return code. |
| request_id | String | zpd0i7dlr7bi | The request ID. |
Response Body Example
{
"errcode":0,
"errmsg":"ok",
"success":true,
"request_id":"zpd0i7dlr7bi"
}