Request
| Basic Information | |
|---|---|
| HTTP URL | https://api.dingtalk.io/topapi/attendance/getusergroup |
| HTTP Method | POST |
| Supported App Types | appType-Internal app appType-Third-party enterprise app |
| Permission Requirements | permission-qyapi_base-Basic permission required to call organization APIs |
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 the Get the access_token of an Internal App API. - For a Third-party enterprise app, obtain it by calling the Get the access_token of a Third-party Enterprise App API. |
Request Body
| Name | Type | Required | Example | Description |
|---|---|---|---|---|
| userid | String | Yes | user123 | The user ID of the employee in your organization. |
Request Example
curl -X POST "https://api.dingtalk.io/topapi/attendance/getusergroup" \
-H 'Content-Type:application/x-www-form-urlencoded;charset=utf-8' \
-d 'access_token=04cd6xxxx91f77' \
-d 'userid=zhangsan'
DingTalkClient client = new DefaultDingTalkClient("https://api.dingtalk.io/topapi/attendance/getusergroup");
OapiAttendanceGetusergroupRequest req = new OapiAttendanceGetusergroupRequest();
req.setUserid("user123");
OapiAttendanceGetusergroupResponse rsp = client.execute(req, access_token);
System.out.println(rsp.getBody());
import dingtalk.api
req=dingtalk.api.OapiAttendanceGetusergroupRequest("https://api.dingtalk.io/topapi/attendance/getusergroup")
req.userid="zhangsan"
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 OapiAttendanceGetusergroupRequest;
$req->setUserid("zhangsan");
$resp = $c->execute($req, $access_token, "https://api.dingtalk.io/topapi/attendance/getusergroup");
IDingTalkClient client = new DefaultDingTalkClient("https://api.dingtalk.io/topapi/attendance/getusergroup");
OapiAttendanceGetusergroupRequest req = new OapiAttendanceGetusergroupRequest();
req.Userid = "zhangsan";
OapiAttendanceGetusergroupResponse rsp = client.Execute(req, access_token);
Console.WriteLine(rsp.Body);
Response
Response Body
| Name | Type | Example | Description |
|---|---|---|---|
| result | AtGroupFullForTopVo | The query result. | |
| name | String | Attendance | The name of the attendance group. |
| group_id | Number | 685935028 | The ID of the attendance group. 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. |
| type | String | TURN | The attendance type: - FIXED: Fixed scheduling - TURN: Rotating scheduling - NONE: No shift |
| classes | AtClassVo[] | The list of shifts in the attendance group. | |
| class_id | Number | 678215070 | The shift ID. |
| name | String | Shift A | The shift name. |
| sections | AtSectionVo[] | The list of on-duty and off-duty sections in the shift. | |
| times | AtTimeVo[] | The list of on-duty and off-duty details in the shift. | |
| check_time | Date | 1970-01-01 19:00:00 | The clock-in time. |
| check_type | String | OnDuty | The clock-in type: - OnDuty: On duty - OffDuty: Off duty |
| across | Number | 0 | The number of days the clock-in time spans. |
| begin_min | Number | 30 | The earliest allowed clock-in time before the scheduled time, in minutes. |
| end_min | Number | 0 | The latest allowed clock-in time after the scheduled time, in minutes. |
| setting | ClassSettingVo | The shift configuration. | |
| rest_begin_time | AtTimeVo | The break start settings. | |
| across | Number | 0 | The time span. - 0: Does not span days - 1: Spans days |
| begin_min | Number | 0 | The start time. |
| end_min | Number | 0 | The end time. |
| check_time | Date | 1970-01-01 19:00:00 | The break start time. |
| check_type | String | OnDuty | The settings type: - OnDuty: Break start - OffDuty: Break end |
| rest_end_time | AtTimeVo | The break end time settings. | |
| across | Number | 0 | The time span. |
| begin_min | Number | 0 | The start time. |
| end_min | Number | 0 | The end time. |
| check_time | Date | 1970-01-01 20:00:00 | The break end time. |
| check_type | String | OffDuty | The clock-in type: - OnDuty: Break start - OffDuty: Break end |
| errcode | Number | 0 | The return code. |
| errmsg | String | ok | The description of the return code. |
| request_id | String | f8zybbfze3e8 | The request ID. |
Response Body Example
{
"errcode": 0,
"result": {
"classes": [
{
"class_id": 677995086,
"name": "A",
"sections": [
{
"times": [
{
"across": 0,
"check_time": "1970-01-01 09:30:00",
"check_type": "OnDuty"
},
{
"across": 0,
"check_time": "1970-01-01 18:30:00",
"check_type": "OffDuty"
}
]
}
],
"setting": {}
},
{
"class_id": 678215070,
"name": "B",
"sections": [
{
"times": [
{
"across": 0,
"check_time": "1970-01-01 19:00:00",
"check_type": "OnDuty"
},
{
"across": 1,
"check_time": "1970-01-01 05:00:00",
"check_type": "OffDuty"
}
]
}
],
"setting": {}
}
],
"group_id": 685935028,
"name": "Attendance",
"type": "FIXED"
},
"request_id": "f8zybbfze3e8"
}