> ## 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/schedule/listbyusers](https://api.dingtalk.io/topapi/attendance/schedule/listbyusers) |
| HTTP メソッド | POST |
| 対応アプリタイプ | appType-社内アプリ　appType-サードパーティ社内アプリ |
| 必須権限 | qyapi\_attendance\_group\_read：勤怠グループの照会権限 |

### クエリパラメータ

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

### リクエストボディ

| 名前 | タイプ | 必須 | 例 | 説明 |
| - | - | - | - | - |
| op\_user\_id | String | はい | user456 | 操作者のユーザー ID です。 |
| userids | String | はい | user123 | 照会するユーザー ID のリストです。複数のユーザー ID はカンマで区切ります。一度に指定できるユーザー ID は最大 50 件です。 |
| from\_date\_time | Number | はい | 1565591096000 | 開始日です。ミリ秒単位の Unix タイムスタンプで指定します。 **注意** - 開始時刻と終了時刻の間隔は 7 日以内にしてください。 - 照会対象の期間は過去 180 日以内である必要があります。 |
| to\_date\_time | Number | はい | 1565591096000 | 終了日です。ミリ秒単位の Unix タイムスタンプで指定します。 **注意** - 開始時刻と終了時刻の間隔は 7 日以内にしてください。 - 照会対象の期間は過去 180 日以内である必要があります。 |

### リクエスト例

```curl theme={"theme":{"light":"github-light","dark":"github-dark"}}
curl -X POST "https://api.dingtalk.io/topapi/attendance/schedule/listbyusers" \
-H 'Content-Type:application/x-www-form-urlencoded;charset=utf-8' \
-d 'access_token=9ad3xxxx82a10' \
-d 'from_date_time=1565591096000' \
-d 'op_user_id=dd_dd' \
-d 'to_date_time=1565591096000' \
-d 'userids=dd_dd%2Cduogui'
```

Java

```java theme={"theme":{"light":"github-light","dark":"github-dark"}}
DingTalkClient client = new DefaultDingTalkClient("https://api.dingtalk.io/topapi/attendance/schedule/listbyusers");
OapiAttendanceScheduleListbyusersRequest req = new OapiAttendanceScheduleListbyusersRequest();
req.setOpUserId("user456");
req.setUserids("user123,user456");
req.setFromDateTime(1565591096000L);
req.setToDateTime(1565591096000L);
OapiAttendanceScheduleListbyusersResponse 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.OapiAttendanceScheduleListbyusersRequest("https://api.dingtalk.io/topapi/attendance/schedule/listbyusers")

req.op_user_id="dd_dd"
req.userids="dd_dd,duogui"
req.from_date_time=1565591096000
req.to_date_time=1565591096000
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 OapiAttendanceScheduleListbyusersRequest;
$req->setOpUserId("dd_dd");
$req->setUserids("dd_dd,duogui");
$req->setFromDateTime("1565591096000");
$req->setToDateTime("1565591096000");
$resp = $c->execute($req, $access_token, "https://api.dingtalk.io/topapi/attendance/schedule/listbyusers");
```

C#

```csharp theme={"theme":{"light":"github-light","dark":"github-dark"}}
IDingTalkClient client = new DefaultDingTalkClient("https://api.dingtalk.io/topapi/attendance/schedule/listbyusers");
OapiAttendanceScheduleListbyusersRequest req = new OapiAttendanceScheduleListbyusersRequest();
req.OpUserId = "dd_dd";
req.Userids = "dd_dd,duogui";
req.FromDateTime = 1565591096000L;
req.ToDateTime = 1565591096000L;
OapiAttendanceScheduleListbyusersResponse rsp = client.Execute(req, access_token);
Console.WriteLine(rsp.Body);
```

## レスポンス

### レスポンスボディ

| 名前 | タイプ | 例 | 説明 |
| - | - | - | - |
| result | TopScheduleVo\[] | demo | 照会結果です。 |
| check\_type | String | OnDuty | 打刻タイプです。 - **Onduty**：出勤時の打刻 - **OffDuty**：退勤時の打刻 |
| plan\_check\_time | Date | 2021-01-14 09:00:00 | 予定されている打刻時刻です。 |
| group\_id | Number | 394775001 | 勤怠グループ ID です。 |
| userid | String | user456 | ユーザー ID です。 |
| approve\_id | Number | 1234 | シフトに紐付けられた承認フォームの ID です。 **注意** 当日に承認フォームが存在しない場合、このフィールドは返されません。 |
| work\_date | Date | 2021-01-14 00:00:00 | 勤務日です。シフトが設定されている具体的な日を示します。 |
| id | Number | 56676915454 | シフト設定 ID です。 |
| shift\_version | Number | 588655171 | シフトのバージョンです。 |
| shift\_id | Number | 677995086 | シフト ID です。値が 0 の場合は休日を示します。 |
| is\_rest | String | N | 当日が休日かどうかを示します。 - **Y**：休日として設定されています - **N**：休日ではありません |
| success | Boolean | true | リクエストが成功したかどうかを示します。 - **true**：成功 - **false**：失敗 |
| errcode | Number | 0 | リターンコードです。 |
| errmsg | String | ok | リターンメッセージです。 |
| request\_id | String | qkqbwcw3bq2 | リクエスト ID です。 |

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

```json theme={"theme":{"light":"github-light","dark":"github-dark"}}
{
  "errcode": 0,
  "errmsg":"ok",
  "result": [
    {
      "check_type": "OnDuty",
      "group_id": 394775001,
      "id": 56676915454,
      "is_rest": "N",
      "plan_check_time": "2021-01-14 09:00:00",
      "shift_id": 709595172,
      "shift_version": 617320362,
      "userid": "user456",
      "work_date": "2021-01-14 00:00:00"
    },
    {
      "check_type": "OffDuty",
      "group_id": 394775001,
      "id": 56676915454,
      "is_rest": "N",
      "plan_check_time": "2021-01-14 18:00:00",
      "shift_id": 709595172,
      "shift_version": 617320362,
      "userid": "user456",
      "work_date": "2021-01-14 00:00:00"
    }
  ],
  "success": true,
  "request_id": "4cmy9twx4atn"
}
```

### エラーコード

この 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.