Request
| Basic Information | |
|---|---|
| HTTP URL | https://api.dingtalk.io/topapi/attendance/record/upload |
| HTTP Method | POST |
| Supported app types | appType-Internal app |
| Required permissions | permission-Pro.AttendanceRecord.Write-Write permission for attendance clock-in records |
Query Parameters
| Name | Type | Required | Example | Description |
|---|---|---|---|---|
| access_token | String | Yes | af21axxx | The App credential used to call this API. Obtain it by calling Get the access_token of an Internal App. |
Request Body
| Name | Type | Required | Example | Description |
|---|---|---|---|---|
| userid | String | Yes | user123 | The user ID of the employee whose clock-in record you want to upload. |
| device_name | String | Yes | East Gate Time Clock | The name of the Time Clock. This value is custom, such as 123456. |
| device_id | String | Yes | abc123456 | The ID of the Time Clock. This value is custom, such as abcde. |
| photo_url | String | No | https://xxx.com/xxx.png | The URL of the clock-in alias image. The URL must be publicly accessible. |
| user_check_time | Number | Yes | 1587020403000 | The time when the employee clocks in, in milliseconds. Note - This parameter must be in milliseconds. - Pass a date within the last 180 days. |
Request Example
curl -X POST "https://api.dingtalk.io/topapi/attendance/record/upload" \
-H 'Content-Type:application/x-www-form-urlencoded;charset=utf-8' \
-d 'access_token=0927xxxx3e28ea' \
-d 'device_id=abc123456' \
-d 'device_name=East%20Gate%20Time%20Clock' \
-d 'photo_url=https%3A%2F%2Fxxx.com%2Fxxx.png' \
-d 'user_check_time=1587020403000' \
-d 'userid=dd_dd'
DingTalkClient client = new DefaultDingTalkClient("https://api.dingtalk.io/topapi/attendance/record/upload");
OapiAttendanceRecordUploadRequest req = new OapiAttendanceRecordUploadRequest();
req.setUserid("dd_dd");
req.setDeviceName("East Gate Time Clock");
req.setDeviceId("abc123456");
req.setPhotoUrl("https://xxx.com/xxx.png");
req.setUserCheckTime(1587020403000L);
OapiAttendanceRecordUploadResponse rsp = client.execute(req, access_token);
System.out.println(rsp.getBody());
import dingtalk.api
req=dingtalk.api.OapiAttendanceRecordUploadRequest("https://api.dingtalk.io/topapi/attendance/record/upload")
req.userid="dd_dd"
req.device_name="East Gate Time Clock"
req.device_id="abc123456"
req.photo_url="https://xxx.com/xxx.png"
req.user_check_time=1587020403000
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 OapiAttendanceRecordUploadRequest;
$req->setUserid("dd_dd");
$req->setDeviceName("East Gate Time Clock");
$req->setDeviceId("abc123456");
$req->setPhotoUrl("https://xxx.com/xxx.png");
$req->setUserCheckTime("1587020403000");
$resp = $c->execute($req, $access_token, "https://api.dingtalk.io/topapi/attendance/record/upload");
IDingTalkClient client = new DefaultDingTalkClient("https://api.dingtalk.io/topapi/attendance/record/upload");
OapiAttendanceRecordUploadRequest req = new OapiAttendanceRecordUploadRequest();
req.Userid = "dd_dd";
req.DeviceName = "East Gate Time Clock";
req.DeviceId = "abc123456";
req.PhotoUrl = "https://xxx.com/xxx.png";
req.UserCheckTime = 1587020403000L;
OapiAttendanceRecordUploadResponse rsp = client.Execute(req, access_token);
Console.WriteLine(rsp.Body);
Response
Response Body
| Name | Type | Example | Description |
|---|---|---|---|
| success | Boolean | true | Indicates whether the call succeeded. |
| errcode | Number | 0 | The return code. |
| errmsg | String | ok | The description of the return code. |
| request_id | String | ktoftehkz2bt | The request ID. |
Response Body Example
{
"errcode":0,
"success":true,
"request_id" : "3ynh2gp5ndke"
}