> ## Documentation Index
> Fetch the complete documentation index at: https://help.dingtalk.io/llms.txt
> Use this file to discover all available pages before exploring further.

# ユーザーの勤怠データの取得

> ユーザー ID と対象日を指定して、打刻記録・打刻結果・承認フォーム一覧などの勤怠データを取得する API です。

この API を呼び出して、ユーザーの勤怠データを取得します。勤怠データには、打刻記録、打刻結果、承認フォーム一覧が含まれます。

## リクエスト

| **基本情報** | |
| - | - |
| HTTP URL | [https://api.dingtalk.io/topapi/attendance/getupdatedata](https://api.dingtalk.io/topapi/attendance/getupdatedata) |
| HTTP メソッド | POST |
| 対応するアプリタイプ | appType-社内アプリ |
| 権限 | permission-qyapi\_get\_attendance\_data-勤怠データの読み取り権限 |

### クエリパラメータ

| 名前 | タイプ | 必須 | 例 | 説明 |
| - | - | - | - | - |
| access\_token | String | はい | 6d1bxxxx | この API の呼び出しに使用するアプリ認証情報です。[社内アプリの access\_token を取得](https://help.dingtalk.io/ja/open/development/obtain-orgapp-token) API を呼び出して取得します。 |

### リクエストボディ

| 名前 | タイプ | 必須 | 例 | 説明 |
| - | - | - | - | - |
| userid | String | はい | user01 | ユーザー ID。 |
| work\_date | Date | はい | 2021-01-14 | 照会する日付。 |

### リクエスト例

```curl theme={"theme":{"light":"github-light","dark":"github-dark"}}
curl -X POST "https://api.dingtalk.io/topapi/attendance/getupdatedata" \
-H 'Content-Type:application/x-www-form-urlencoded;charset=utf-8' \
-d 'access_token=e67ccxxxx2144c' \
-d 'userid=userId123456' \
-d 'work_date=2018-05-02+00%3A00%3A00'
```

Java

```java theme={"theme":{"light":"github-light","dark":"github-dark"}}
DingTalkClient client = new DefaultDingTalkClient("https://api.dingtalk.io/topapi/attendance/getupdatedata");
OapiAttendanceGetupdatedataRequest req = new OapiAttendanceGetupdatedataRequest();
req.setUserid("user01");
req.setWorkDate(StringUtils.parseDateTime("2021-01-14"));
OapiAttendanceGetupdatedataResponse rsp = client.execute(req, access_token);
System.out.println(rsp.getBody());
```

Python

```python theme={"theme":{"light":"github-light","dark":"github-dark"}}
import dingtalk.api

req=dingtalk.api.OapiAttendanceGetupdatedataRequest("https://api.dingtalk.io/topapi/attendance/getupdatedata")

req.userid="userId123456"
req.work_date="2018-05-02 00:00:00"
try:
  resp= req.getResponse(access_token)
  print(resp)
except Exception,e:
  print(e)
```

PHP

```php theme={"theme":{"light":"github-light","dark":"github-dark"}}
include "TopSdk.php";
date_default_timezone_set('Asia/Shanghai');

$c = new DingTalkClient(DingTalkConstant::$CALL_TYPE_OAPI, DingTalkConstant::$METHOD_POST , DingTalkConstant::$FORMAT_JSON);
$req = new OapiAttendanceGetupdatedataRequest;
$req->setUserid("userId123456");
$req->setWorkDate("2018-05-02 00:00:00");
$resp = $c->execute($req, $access_token, "https://api.dingtalk.io/topapi/attendance/getupdatedata");
```

C#

```csharp theme={"theme":{"light":"github-light","dark":"github-dark"}}
IDingTalkClient client = new DefaultDingTalkClient("https://api.dingtalk.io/topapi/attendance/getupdatedata");
OapiAttendanceGetupdatedataRequest req = new OapiAttendanceGetupdatedataRequest();
req.Userid = "userId123456";
req.WorkDate = DateTime.Parse("2018-05-02 00:00:00");
OapiAttendanceGetupdatedataResponse rsp = client.Execute(req, access_token);
Console.WriteLine(rsp.Body);
```

## レスポンス

### レスポンスボディ

| 名前 | タイプ | 例 | 説明 |
| - | - | - | - |
| errmsg | String | ok | 戻りコードの説明。 |
| result | AtCheckInfoForOpenVo | | 呼び出し結果。 |
| work\_date | Date | 2021-01-14 00:00:00 | 照会する日付。 |
| attendance\_result\_list | AtAttendanceResultForOpenVo\[] | | 打刻結果。 |
| record\_id | Number | 53429818546 | 打刻記録 ID。 |
| source\_type | String | USER | 打刻のソース。   - **USER**：ユーザーによる打刻 - **BOSS**：管理者による修正 - **APPROVE**：承認システム - **SYSTEM**：勤怠システム - **AUTO\_CHECK**：自動打刻 |
| plan\_check\_time | Date | 2021-01-14 09:00:00 | 標準の打刻時刻。 |
| class\_id | Number | 709595172 | シフト ID。 |
| location\_method | String | MAP | 位置情報の取得方法。 |
| location\_result | String | Normal | 位置情報の判定結果。   - **Normal**：範囲内 - **Outside**：範囲外 - **NotSigned**：未打刻 |
| outside\_remark | String | 外勤 | 外勤の備考。 |
| plan\_id | Number | 176929277767 | シフト設定 ID。 |
| user\_address | String | 緑城未来パーク | ユーザーが打刻した住所。 |
| group\_id | Number | 710705191 | 勤怠グループ ID。 |
| user\_check\_time | Date | 2021-01-14 11:21:59 | ユーザーが打刻した時刻。 |
| procInst\_id | String | PRO-xxx | 承認フォーム ID。 |
| check\_type | String | OnDuty | 打刻のタイプ。   - **OnDuty**：出勤打刻 - **OffDuty**：退勤打刻 |
| time\_result | String | Late | 打刻の時間判定結果。   - **Normal**：正常 - **Early**：早退 - **Late**：遅刻 - **SeriousLate**：重大な遅刻 - **Absenteeism**：遅刻による欠勤 - **NotSigned**：未打刻 |
| userid | String | user01 | ユーザー ID。 |
| approve\_list | AtApproveForOpenVo\[] | | 承認フォームの一覧。 |
| duration\_unit | String | day | 承認フォームの単位。 |
| duration | String | 2.0 | 期間。 |
| sub\_type | String | 年次有給休暇 | サブタイプ名。 |
| tag\_name | String | 请假（休暇申請） | 承認フォームのタイプ名。対応するタイプは次のとおりです。   - **请假**（休暇申請） - **出差**（出張） - **外出**（外出） - **加班**（残業） |
| procInst\_id | String | 1234abcd | 承認フォーム ID。 |
| begin\_time | Date | 2019-08-15 | 承認フォームの開始時刻。 |
| biz\_type | Number | 3 | 承認フォームのタイプ。   - **1**：残業 - **2**：出張／外出 - **3**：休暇申請 |
| end\_time | Date | 2019-08-17 | 承認フォームの終了時刻。 |
| gmt\_finished | Date | 2019-08-15 | 承認フォームが承認された時刻。 |
| check\_record\_list | AtAttendanceRecordForOpenVo\[] | | 打刻詳細。 |
| record\_id | Number | 52710882700 | 打刻記録 ID。 |
| source\_type | String | | 打刻のソース。   - **USER**：ユーザーによる打刻 - **BOSS**：管理者による修正 - **APPROVE**：承認システム - **SYSTEM**：勤怠システム - **AUTO\_CHECK**：自動打刻 |
| user\_accuracy | String | 15.0 | ユーザーの位置情報の精度。 |
| valid\_matched | Boolean | false | 記録が打刻結果と一致するかどうか。   - **true**：一致 - **false**：不一致 |
| user\_check\_time | Date | 2021-01-14 11:19:04 | ユーザーが打刻した時刻。 |
| user\_longitude | String | 120.017267 | 打刻地点の経度。 |
| user\_ssid | String | office-wifi-1 | Wi-Fi 名。 |
| base\_accuracy | String | 0.0 | 基準となる位置情報の精度。 |
| user\_mac\_addr | String | 11:11:11:11:11:11 | MAC アドレス。 |
| user\_latitude | String | 30.285938 | 打刻地点の緯度。 |
| base\_address | String | テスト | 基準となる打刻住所。 |
| invalid\_record\_msg | String | 二次確認が必要です | 打刻が無効となった理由。 |
| invalid\_record\_type | String | Other | 無効な打刻のタイプ。 |
| corpId | String | dinge8xxxx | 組織 ID（corpId）。 |
| class\_setting\_info | AtClassSettingInfoForOpenVo | | 現在のシフトの休憩時間帯。 |
| rest\_time\_vo\_list | AtRestTimeVo\[] | | シフト内の休憩情報。 |
| rest\_end\_time | Number | 0 | 休憩の終了時刻。 |
| rest\_begin\_time | Number | 0 | 休憩の開始時刻。 |
| errcode | Number | 0 | 戻りコード。 |
| success | Boolean | true | 呼び出しに成功したかどうか。   - **true**：成功 - **false**：失敗 |
| request\_id | String | f1zwcp4fr28h | リクエスト ID。 |

### レスポンスボディの例

```json theme={"theme":{"light":"github-light","dark":"github-dark"}}
{
  "errcode": 0,
  "result": {
    "approve_list": [],
    "attendance_result_list": [
      {
        "location_method": "MAP",
        "record_id": 53429818546,
        "group_id": 710705191,
        "location_result": "Normal",
        "class_id": 709595172,
        "time_result": "Late",
        "user_address": "緑城未来パーク",
        "user_check_time": "2021-01-14 11:21:59",
        "plan_check_time": "2021-01-14 09:00:00",
        "check_type": "OnDuty",
        "source_type": "USER",
        "plan_id": 176929277767
      }
    ],
    "corpId": "dinge8xxxx",
    "work_date": "2021-01-14 09:00:00",
    "userid": "user01",
    "check_record_list": [
      {
        "record_id": 52710882700,
        "user_check_time": "2021-01-14 11:19:04",
        "valid_matched": false,
        "user_accuracy": "15.0",
        "source_type": "USER",
        "invalid_record_msg": "外勤打刻には承認が必要です",
        "invalid_record_type": "Other",
        "user_longitude": "120.017267",
        "user_latitude": "30.286036"
      },
      {
        "record_id": 53019968340,
        "user_check_time": "2021-01-14 17:00:45",
        "valid_matched": false,
        "source_type": "USER",
        "invalid_record_msg": "現在の時間帯は打刻できません。管理者に連絡してください。",
        "invalid_record_type": "Other"
      }
    ]
  },
  "success": true,
  "request_id": "f1zwcp4fr28h"
}
```

### エラーコード

この API の呼び出し時にエラーが発生した場合は、エラーメッセージをもとに [グローバルエラーコード](https://help.dingtalk.io/ja/open/development/server-api-error-codes-1.md) ドキュメントで解決方法を確認してください。


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.