> ## 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 と操作者の userId を指定して勤怠シフトを削除する API です。リクエストパラメータ、各言語のコード例、レスポンス内容を確認できます。

シフト ID を指定して勤怠シフトを削除するには、この API を呼び出します。

## リクエスト

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

### クエリパラメータ

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

### リクエストボディ

| 名前 | タイプ | 必須 | 例 | 説明 |
| - | - | - | - | - |
| op\_user\_id | String | はい | user123 | 操作者の userId です。 |
| shift\_id | Number | はい | 2423 | シフト 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/delete" \
-H 'Content-Type:application/x-www-form-urlencoded;charset=utf-8' \
-d 'access_token=032bc0xxxxc460ee' \
-d 'op_user_id=abc' \
-d 'shift_id=2423'
```

Java

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

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

C#

```csharp theme={"theme":{"light":"github-light","dark":"github-dark"}}
IDingTalkClient client = new DefaultDingTalkClient("https://api.dingtalk.io/topapi/attendance/shift/delete");
OapiAttendanceShiftDeleteRequest req = new OapiAttendanceShiftDeleteRequest();
req.OpUserId = "abc";
req.ShiftId = 2423L;
OapiAttendanceShiftDeleteResponse rsp = client.Execute(req, access_token);
Console.WriteLine(rsp.Body);
```

## レスポンス

### レスポンスボディ

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

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

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

### エラーコード

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