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

# Perbarui pengaturan rentang waktu absen

> Gunakan API DingTalk ini untuk memperbarui pengaturan rentang waktu absen pada shift absensi dan menentukan apakah absen wajib dilakukan di setiap titik absen.

Panggil API ini untuk memperbarui pengaturan waktu absen pada shift absensi. Saat ini, API ini hanya mendukung pengaturan apakah absen wajib dilakukan di suatu titik absen.

## Permintaan

| **Informasi dasar** | |
| - | - |
| URL HTTP | [https://api.dingtalk.io/topapi/attendance/shift/updatepunches](https://api.dingtalk.io/topapi/attendance/shift/updatepunches) |
| Metode HTTP | POST |
| Jenis aplikasi yang didukung | appType-Aplikasi internal |
| Izin yang diperlukan | permission-qyapi\_attendance\_group\_manage-Izin kelola grup absensi |

### Parameter query

| Nama | Tipe | Wajib | Contoh | Deskripsi |
| - | - | - | - | - |
| access\_token | String | Ya | af21axxx | Kredensial aplikasi yang digunakan untuk memanggil API ini. Dapatkan dengan memanggil API [Mendapatkan access\_token aplikasi internal](https://help.dingtalk.io/id/open/development/obtain-orgapp-token). |

### Isi permintaan

| Nama | Tipe | Wajib | Contoh | Deskripsi |
| - | - | - | - | - |
| op\_user\_id | String | Ya | user456 | userId operator. |
| punches | TopPunchVO\[] | Tidak | | Informasi titik absen. |
| id | Number | Ya | 123 | ID titik absen. Dapatkan nilai id dengan memanggil API [Mendapatkan detail shift](https://help.dingtalk.io/id/open/development/shift-query.md). |
| free\_check | Boolean | Ya | true | Menentukan apakah absen tidak diwajibkan.   - **true**: Pembebasan absen aktif. - **false**: Pembebasan absen nonaktif. |
| shift\_id | Number | Ya | 456 | ID shift. Dapatkan nilai id dengan memanggil API [Mendapatkan ringkasan shift](https://help.dingtalk.io/id/open/development/enterprise-shift-query-in-batches.md). |

### Contoh permintaan

```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);
```

## Respons

### Isi respons

| Nama | Tipe | Contoh | Deskripsi |
| - | - | - | - |
| success | Boolean | true | Menunjukkan apakah panggilan berhasil.   - **true**: Berhasil - **false**: Gagal |
| errcode | Number | 0 | Kode respons. |
| errmsg | String | Error sistem | Pesan error yang dikembalikan saat panggilan gagal. |
| request\_id | String | 5moh5icna65x | ID permintaan. |

### Contoh isi respons

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

### Kode error

Jika terjadi error saat memanggil API ini, cari solusinya di dokumen [Kode error global](https://help.dingtalk.io/id/open/development/server-api-error-codes-1.md) berdasarkan pesan error yang diterima.


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