Request
| Basic Information | |
|---|---|
| HTTP URL | https://api.dingtalk.io/topapi/attendance/getleaveapproveduration |
| HTTP Method | POST |
| Supported app types | appType-Internal app appType-Third-party enterprise app |
| Required permissions | 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. - Internal app: Get it by calling Get the access_token of an internal app. - Third-party enterprise app: Get it by calling the API that gets the access_token of a third-party enterprise. |
Request Body
| Name | Type | Required | Example | Description |
|---|---|---|---|---|
| userid | String | Yes | user123 | The employee’s user ID in your organization. The organization uses this field to uniquely identify the user. |
| from_date | Date | Yes | 2016-03-09 11:11:11 | The start time of the leave. |
| to_date | Date | Yes | 2016-03-10 11:11:11 | The end time of the leave. |
Request Example
curl -X POST "https://api.dingtalk.io/topapi/attendance/getleaveapproveduration" \
-H 'Content-Type:application/x-www-form-urlencoded;charset=utf-8' \
-d 'access_token=6777xxxx6f4eff' \
-d 'from_date=2016-03-09+11%3A11%3A11' \
-d 'to_date=2016-03-10+11%3A11%3A11' \
-d 'userid=zhangsan'
DingTalkClient client = new DefaultDingTalkClient("https://api.dingtalk.io/topapi/attendance/getleaveapproveduration");
OapiAttendanceGetleaveapprovedurationRequest req = new OapiAttendanceGetleaveapprovedurationRequest();
req.setUserid("user123");
req.setFromDate(StringUtils.parseDateTime("2016-03-09 11:11:11"));
req.setToDate(StringUtils.parseDateTime("2016-03-10 11:11:11"));
OapiAttendanceGetleaveapprovedurationResponse rsp = client.execute(req, access_token);
System.out.println(rsp.getBody());
import dingtalk.api
req=dingtalk.api.OapiAttendanceGetleaveapprovedurationRequest("https://api.dingtalk.io/topapi/attendance/getleaveapproveduration")
req.userid="zhangsan"
req.from_date="2016-03-09 11:11:11"
req.to_date="2016-03-10 11:11:11"
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 OapiAttendanceGetleaveapprovedurationRequest;
$req->setUserid("zhangsan");
$req->setFromDate("2016-03-09 11:11:11");
$req->setToDate("2016-03-10 11:11:11");
$resp = $c->execute($req, $access_token, "https://api.dingtalk.io/topapi/attendance/getleaveapproveduration");
IDingTalkClient client = new DefaultDingTalkClient("https://api.dingtalk.io/topapi/attendance/getleaveapproveduration");
OapiAttendanceGetleaveapprovedurationRequest req = new OapiAttendanceGetleaveapprovedurationRequest();
req.Userid = "zhangsan";
req.FromDate = DateTime.Parse("2016-03-09 11:11:11");
req.ToDate = DateTime.Parse("2016-03-10 11:11:11");
OapiAttendanceGetleaveapprovedurationResponse rsp = client.Execute(req, access_token);
Console.WriteLine(rsp.Body);
Response
Response Body
| Name | Type | Example | Description |
|---|---|---|---|
| result | ApproveDurationForTopVo | The returned result. | |
| duration_in_minutes | Number | 0 | The leave duration, in minutes. |
| errcode | Number | 0 | The return code. |
| errmsg | String | ok | The description of the return code. |
| request_id | String | 3ynh2gp5ndke | The request ID. |
Response Body Example
{
"errcode": 0,
"errmsg":"ok",
"result": {
"duration_in_minutes": 480
},
"request_id": "6porp1hqkb9k"
}