> ## 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 を呼び出して、シフト ID を指定してシフトの詳細を照会します。シフト名、打刻時刻、休憩時間などを取得できます。

## リクエスト

| **基本情報** | |
| - | - |
| HTTP URL | [https://api.dingtalk.io/topapi/attendance/shift/query](https://api.dingtalk.io/topapi/attendance/shift/query) |
| HTTP メソッド | POST |
| 対応アプリタイプ | appType-社内アプリ　appType-サードパーティ社内アプリ |
| 権限 | permission-qyapi\_attendance\_group\_read-勤怠グループの照会権限 |

### クエリパラメータ

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

### リクエストボディ

| 名前 | タイプ | 必須 | 例 | 説明 |
| - | - | - | - | - |
| op\_user\_id | String | はい | user123 | 操作者の userId です。 |
| shift\_id | Number | はい | 678215070 | シフト ID です。[シフト概要の取得](https://help.dingtalk.io/ja/open/development/enterprise-shift-query-in-batches.md) API を呼び出して、id パラメータの値を取得します。 |

### リクエスト例

```curl theme={"theme":{"light":"github-light","dark":"github-dark"}}
curl -X POST "https://api.dingtalk.io/topapi/attendance/shift/query" \
-H 'Content-Type:application/x-www-form-urlencoded;charset=utf-8' \
-d 'access_token=d946568c-08dd-44bf-acd3-cfc07d7829dd' \
-d 'op_user_id=dd_dd' \
-d 'shift_id=2445'
```

Java

```java theme={"theme":{"light":"github-light","dark":"github-dark"}}
DingTalkClient client = new DefaultDingTalkClient("https://api.dingtalk.io/topapi/attendance/shift/query");
OapiAttendanceShiftQueryRequest req = new OapiAttendanceShiftQueryRequest();
req.setOpUserId("user123");
req.setShiftId(678215070L);
OapiAttendanceShiftQueryResponse 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.OapiAttendanceShiftQueryRequest("https://api.dingtalk.io/topapi/attendance/shift/query")

req.op_user_id="dd_dd"
req.shift_id=2445
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 OapiAttendanceShiftQueryRequest;
$req->setOpUserId("dd_dd");
$req->setShiftId("2445");
$resp = $c->execute($req, $access_token, "https://api.dingtalk.io/topapi/attendance/shift/query");
```

C#

```csharp theme={"theme":{"light":"github-light","dark":"github-dark"}}
IDingTalkClient client = new DefaultDingTalkClient("https://api.dingtalk.io/topapi/attendance/shift/query");
OapiAttendanceShiftQueryRequest req = new OapiAttendanceShiftQueryRequest();
req.OpUserId = "dd_dd";
req.ShiftId = 2445L;
OapiAttendanceShiftQueryResponse rsp = client.Execute(req, access_token);
Console.WriteLine(rsp.Body);
```

## レスポンス

### レスポンスボディ

| 名前 | タイプ | 例 | 説明 |
| - | - | - | - |
| result | TopShiftVo | | シフト詳細です。 |
| shift\_group\_name | String | 勤怠シフト | シフトグループの名前です。 |
| corp\_id | String | dinge87f1xxxx | 組織 ID です。 |
| shift\_setting | TopShiftSettingVo | | シフト設定です。 |
| shift\_id | Number | 678215070 | シフト ID です。 |
| gmt\_modified | Date | 2020-09-06 15:49:27 | シフトの最終更新日時です。 |
| corp\_id | String | dinge87f1xxxx | 組織 ID です。 |
| work\_time\_minutes | Number | 600 | 勤務時間です（単位：分）。-1 の場合、この機能は無効です。 |
| id | Number | 233840112 | シフト設定 ID です。 |
| attend\_days | String | 12 | このシフトの出勤日数です。 |
| gmt\_create | Date | 2020-09-06 15:49:27 | 作成時間です。 |
| name | String | B | シフト名です。 |
| id | Number | 678215070 | シフト ID です。 |
| sections | TopSectionVo\[] | | 打刻区間です。 |
| punches | TopPunchVo\[] | | 打刻ポイントです。 |
| check\_type | String | OnDuty | 打刻タイプです。   - **OnDuty**：出勤打刻 - **OffDuty**：退勤打刻 |
| end\_min | Number | -1 | 打刻が可能な最も遅い時刻です。  単位は分です。打刻時刻にこの値を加算して、最も遅い打刻時刻を計算します。 |
| across | Number | 0 | 打刻時刻が翌日にあたるかどうかを示します。   - **0**：当日 - **1**：翌日 |
| check\_time | Date | 1970-01-01 19:00:00 | 打刻時刻です（Unix タイムスタンプ）。時・分・秒のみが有効です。 |
| permit\_minutes | Number | 0 | 早退または遅刻の許容時間です（単位：分）。 |
| free\_check | Boolean | false | 打刻が免除されるかどうかを示します。   - **true**：打刻免除 - **false**：打刻必須 |
| id | Number | 33928201 | 打刻ポイント ID です。 |
| begin\_min | Number | 20 | 事前打刻が可能な最も早い時間です（単位：分）。 |
| absenteeism\_late\_minutes | String | -1 | 欠勤とみなされる早退または遅刻の時間です（単位：分）。 |
| serious\_late\_minutes | String | -1 | 重度とみなされる早退または遅刻の時間です（単位：分）。 |
| rests | TopRestVo\[] | | 休憩時間の情報です。 |
| check\_type | String | OnDuty | 休憩タイプです。   - **OnDuty**：休憩開始 - **OffDuty**：休憩終了 |
| across | Number | 1 | 休憩時刻が翌日にあたるかどうかを示します。   - **0**：当日 - **1**：翌日 |
| check\_time | String | 1970-01-01 05:00:00 | 休憩時刻です。 |
| id | Number | 33928203 | 休憩ポイント ID です。 |
| id | Number | 22979360 | 打刻区間 ID です。出勤打刻と退勤打刻の 1 組で 1 つの区間を構成します。1 つのシフトに複数の区間を含められます。 |
| shift\_group\_id | Number | demo | シフトグループ ID です。 |
| owner | String | user123 | シフト所有者の userId です。 |
| success | Boolean | true | 呼び出しに成功したかどうかを示します。   - **true**：成功 - **false**：失敗 |
| errcode | Number | 0 | 戻りコードです。 |
| errmsg | String | demo | 戻りコードの説明です。 |

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

```json theme={"theme":{"light":"github-light","dark":"github-dark"}}
{
  "errcode": 0,
  "errmsg": "demo",
  "result": {
    "corp_id": "dinge87f1xxxx",
    "id": 678215070,
    "name": "B",
    "sections": [
      {
        "id": 316940162,
        "punches": [
          {
            "absenteeism_late_minutes": "-1",
            "across": 0,
            "check_time": "1970-01-01 19:00:00",
            "check_type": "OnDuty",
            "free_check": false,
            "id": 340055347,
            "permit_minutes": 0,
            "serious_late_minutes": "-1"
          },
          {
            "across": 1,
            "check_time": "1970-01-01 05:00:00",
            "check_type": "OffDuty",
            "free_check": false,
            "id": 340055348
          }
        ],
        "rests": []
      }
    ],
    "shift_setting": {
      "corp_id": "dinge87f1xxxx",
      "gmt_create": "2020-09-06 15:49:27",
      "gmt_modified": "2020-09-06 15:49:27",
      "id": 586985140,
      "is_deleted": "N",
      "shift_id": 678215070,
      "work_time_minutes": 600
    }
  },
  "success": true,
  "request_id": "3pph7tq865kz"
}
```

### エラーコード

呼び出しでエラーが返された場合は、エラーメッセージをもとに[グローバルエラーコード](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.