Request
| Basic Information | |
|---|---|
| HTTP URL | https://api.dingtalk.io/topapi/attendance/vacation/type/list |
| HTTP Method | POST |
| Supported app types | appType-Internal app appType-Third-party enterprise app |
| Required permissions | permission-qyapi_holiday_readonly-DingTalk leave read 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 the Get the access_token of an Internal App API. - For a Third-party enterprise app, obtain it by calling the API for getting the access_token of a third-party organization. |
Request Body
| Name | Type | Required | Example | Description |
|---|---|---|---|---|
| op_userid | String | Yes | user01 | The user ID of an Admin in your organization who has App permissions for the OA Approval App. |
| vacation_source | String | No | all | The leave source. Valid values: - “all”: Returns all leave types. - "": Returns only the leave types created by calling the API for adding leave rules. |
Request Example
curl -X POST "https://api.dingtalk.io/topapi/attendance/vacation/type/list" \
-H 'Content-Type:application/x-www-form-urlencoded;charset=utf-8' \
-d 'access_token=43aexxxxd897cd9' \
-d 'op_userid=03085665764167' \
-d 'vacation_source=all'
DingTalkClient client = new DefaultDingTalkClient("https://api.dingtalk.io/topapi/attendance/vacation/type/list");
OapiAttendanceVacationTypeListRequest req = new OapiAttendanceVacationTypeListRequest();
req.setOpUserid("user01");
req.setVacationSource("all");
OapiAttendanceVacationTypeListResponse rsp = client.execute(req, access_token);
System.out.println(rsp.getBody());
import dingtalk.api
req=dingtalk.api.OapiAttendanceVacationTypeListRequest("https://api.dingtalk.io/topapi/attendance/vacation/type/list")
req.op_userid="03085665764167"
req.vacation_source="all"
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 OapiAttendanceVacationTypeListRequest;
$req->setOpUserid("03085665764167");
$req->setVacationSource("all");
$resp = $c->execute($req, $access_token, "https://api.dingtalk.io/topapi/attendance/vacation/type/list");
IDingTalkClient client = new DefaultDingTalkClient("https://api.dingtalk.io/topapi/attendance/vacation/type/list");
OapiAttendanceVacationTypeListRequest req = new OapiAttendanceVacationTypeListRequest();
req.OpUserid = "03085665764167";
req.VacationSource = "all";
OapiAttendanceVacationTypeListResponse rsp = client.Execute(req, access_token);
Console.WriteLine(rsp.Body);
Response
Response Body
| Name | Type | Example | Description |
|---|---|---|---|
| request_id | String | 3k4z2hq8pv2x | The request ID. |
| errcode | Number | 0 | The return code. |
| errmsg | String | ok | The description of the return code. |
| success | Boolean | true | Indicates whether the request succeeded. - true: Yes - false: No |
| result | Result[] | The returned results. | |
| leave_code | String | 037477sdfsxxxx | The unique identifier of the leave rule. |
| leave_name | String | Annual leave | The leave name. |
| leave_view_unit | String | day | The leave unit. - day: Day - halfDay: Half day - hour: Hour |
| leave_certificate | LeaveCertificateVo | The leave certificate. | |
| leave_certificate.unit | String | hour | The unit of the leave certificate. - hour: Hour - day: Day |
| leave_certificate.duration | Number | 1 | The leave duration above which a leave certificate is required. |
| leave_certificate.enable | Boolean | false | Indicates whether the leave certificate is turned on. - true: On - false: Off |
| leave_certificate.prompt_information | String | Leave information | The prompt text shown for a leave request. |
| submit_time_rule | SubmitTimeRuleVo | The time-limited submission rule. | |
| submit_time_rule.time_value | Number | 18 | The limit value. - When timeUnit is day, the valid range is 0 to 30 days. - When timeUnit is hour, the valid range is 0 to 24 hours. |
| submit_time_rule.time_unit | String | hour | The time unit. - day: Day - hour: Hour |
| submit_time_rule.time_type | String | before | The limit type. - before: Submit in advance - after: Submit retroactively |
| submit_time_rule.enable_time_limit | Boolean | false | Indicates whether time-limited submission is turned on. - true: On - false: Off |
| biz_type | String | general_leave | The leave type. - general_leave: Regular leave - lieu_leave: Overtime converted to compensatory leave |
| natural_day_leave | String | true | Indicates whether the leave duration is calculated by calendar day. - true: Calculate the leave duration by calendar day. - false: Do not calculate the leave duration by calendar day. Note When the value is false, the leave duration is calculated based on the User’s scheduling during the leave period when the User submits a leave request. |
| validity_type | String | absolute_time | The validity type. - absolute_time: Absolute time - relative_time: Relative time |
| validity_value | String | 12-31 | The extension date. - When validity_type is absolute_time, this value is not empty and uses the “yy-mm” format. - When validity_type is relative_time, this value is an integer greater than 1. |
| hours_in_per_day | Number | 1000 | The working hours per day, in units of 1/100 hour. For example: 1 day = 10 hours = 1000. |
| source | String | inner | The leave source. - external: Custom leave created through the Open API - inner: Leave created in the OA admin console |
Response Body Example
{
"errcode": 0,
"errmsg":"ok",
"result": [
{
"biz_type": "general_leave",
"hours_in_per_day": 1000,
"leave_code": "037477sdfsxxxx",
"leave_name": "Annual leave",
"leave_view_unit": "day",
"leave_certificate": {
"unit": "hour",
"duration": "1",
"enable": false,
"prompt_information": "Leave information"
},
"submit_time_rule": {
"time_value": 18,
"time_unit": "day",
"time_type": "before",
"enable_time_limit": false
},
"validity_type": "absolute_time",
"natural_day_leave": "true",
"validity_value": "12-31",
"source": "external"
}
],
"success": true,
"request_id": "3k4z2hq8pv2x"
}