> ## 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.

# 打刻時間帯の設定の更新

> 勤怠シフトの打刻時間帯の設定を更新するサーバー API です。打刻ポイントごとに打刻の要否を指定でき、リクエストパラメータやレスポンスを紹介します。

この API を呼び出して、勤怠シフトの打刻時間帯の設定を更新します。現在、この API で指定できるのは、打刻ポイントで打刻が必要かどうかのみです。

## リクエスト

| **基本情報** | |
| - | - |
| HTTP URL | [https://api.dingtalk.io/topapi/attendance/shift/updatepunches](https://api.dingtalk.io/topapi/attendance/shift/updatepunches) |
| HTTP メソッド | POST |
| 対応するアプリタイプ | appType-社内アプリ |
| 必要な権限 | permission-qyapi\_attendance\_group\_manage-勤怠グループ管理権限 |

### クエリパラメータ

| 名前 | タイプ | 必須 | 例 | 説明 |
| - | - | - | - | - |
| access\_token | 文字列 | はい | af21axxx | この API を呼び出すためのアプリ認証情報です。[社内アプリの access\_token を取得](https://help.dingtalk.io/ja/open/development/obtain-orgapp-token) API を呼び出して取得してください。 |

### リクエストボディ

| 名前 | タイプ | 必須 | 例 | 説明 |
| - | - | - | - | - |
| op\_user\_id | 文字列 | はい | user456 | 操作者の userId です。 |
| punches | TopPunchVO\[] | いいえ | | 打刻ポイントの情報です。 |
| id | 数値 | はい | 123 | 打刻ポイントの ID です。[シフト詳細の取得](https://help.dingtalk.io/ja/open/development/shift-query.md) API を呼び出して id の値を取得してください。 |
| free\_check | 真偽値 | はい | true | 打刻を不要にするかどうかを指定します。   - **true**：打刻免除をオンにします。 - **false**：打刻免除をオフにします。 |
| shift\_id | 数値 | はい | 456 | シフト 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/updatepunches" \
-H 'Content-Type:application/x-www-form-urlencoded;charset=utf-8' \
-d 'access_token=16869xxx0e890' \
-d 'op_user_id=dd' \
-d 'punches=null' \
-d 'shift_id=456'
```

Java

```java theme={"theme":{"light":"github-light","dark":"github-dark"}}
DingTalkClient client = new DefaultDingTalkClient("https://api.dingtalk.io/topapi/attendance/shift/updatepunches");
OapiAttendanceShiftUpdatepunchesRequest req = new OapiAttendanceShiftUpdatepunchesRequest();
List<TopPunchVO> punchVOS = new ArrayList<>();
TopPunchVO punchVO = new TopPunchVO();
punchVO.setFreeCheck(true);
punchVO.setId(373271823L);
req.setPunches(punchVOS);
req.setOpUserId("user456");
req.setShiftId(712550377L);
OapiAttendanceShiftUpdatepunchesResponse 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.OapiAttendanceShiftUpdatepunchesRequest("https://api.dingtalk.io/topapi/attendance/shift/updatepunches")

req.op_user_id="dd"
req.punches=""
req.shift_id=456
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 OapiAttendanceShiftUpdatepunchesRequest;
$req->setOpUserId("dd");
$punches = new TopPunchVO;
$punches->id="123";
$punches->free_check="true";
$req->setPunches(array($punches));
$req->setShiftId("456");
$resp = $c->execute($req, $access_token, "https://api.dingtalk.io/topapi/attendance/shift/updatepunches");
```

C#

```csharp theme={"theme":{"light":"github-light","dark":"github-dark"}}
IDingTalkClient client = new DefaultDingTalkClient("https://api.dingtalk.io/topapi/attendance/shift/updatepunches");
OapiAttendanceShiftUpdatepunchesRequest req = new OapiAttendanceShiftUpdatepunchesRequest();
req.OpUserId = "dd";
List<OapiAttendanceShiftUpdatepunchesRequest.TopPunchVODomain> list2 = new List<OapiAttendanceShiftUpdatepunchesRequest.TopPunchVODomain>();
OapiAttendanceShiftUpdatepunchesRequest.TopPunchVODomain obj3 = new OapiAttendanceShiftUpdatepunchesRequest.TopPunchVODomain();
list2.Add(obj3);
obj3.Id = 123L;
obj3.FreeCheck = true;
req.Punches_ = list2;
req.ShiftId = 456L;
OapiAttendanceShiftUpdatepunchesResponse rsp = client.Execute(req, access_token);
Console.WriteLine(rsp.Body);
```

## レスポンス

### レスポンスボディ

| 名前 | タイプ | 例 | 説明 |
| - | - | - | - |
| success | 真偽値 | true | 呼び出しに成功したかどうかを示します。   - **true**：成功 - **false**：失敗 |
| errcode | 数値 | 0 | リターンコードです。 |
| errmsg | 文字列 | システムエラー | 呼び出しに失敗した場合に返されるエラーメッセージです。 |
| request\_id | 文字列 | 5moh5icna65x | リクエスト ID です。 |

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

```json theme={"theme":{"light":"github-light","dark":"github-dark"}}
{
  "errcode": 0,
  "success": true,
  "request_id": "ed67bcymo0bw"
}
```

### エラーコード

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