Path: API › 计划任务

`POST /crontab`

修改已有计划任务的配置。

## Request body

_Required._

- `action32.request_time` (string, required) — Unix 时间戳。
- `action32.request_token` (string, required) — 按 API 概览生成的签名。
- `action32.action` (string, required) — 具体操作名称。
  - one of `"modify_crond"`
- `action32.id` (integer, required) — 任务 ID
- `action32.name` (string, required) — 新任务名称
- `action32.type` (string, required) — 周期类型
- `action32.where1` (string, required) — 周期值
- `action32.sType` (string, required) — 任务类型
- `action32.sBody` (string, required) — 执行内容
- `action32.sName` (string, optional) — 备注

## Example request

```text
{
  "request_time": "string",
  "request_token": "string",
  "action": "modify_crond",
  "id": 0,
  "name": "string",
  "type": "string",
  "where1": "string",
  "sType": "string",
  "sBody": "string",
  "sName": "string"
}
```

## Code samples

### cURL（填写面板地址与签名）

```curl
curl --request POST \
  --url "https://your-panel.example.com:8888/crontab" \
  --header "Content-Type: application/x-www-form-urlencoded" \
  --data-urlencode "request_time=<Unix时间戳>" \
  --data-urlencode "request_token=<按 API 概览生成的签名>" \
  --data-urlencode "action=modify_crond" \
  --data-urlencode "id=<id>" \
  --data-urlencode "name=<name>" \
  --data-urlencode "type=<type>" \
  --data-urlencode "where1=<where1>" \
  --data-urlencode "sType=<sType>" \
  --data-urlencode "sBody=<sBody>"
```

## Responses

### default

接口响应，业务状态见下方详细说明。

#### Example

```json
{
  "status": true,
  "msg": "修改成功"
}
```

- `action32.response.default.status` (boolean, optional) — 请求结果，`true` 表示成功
- `action32.response.default.msg` (string, optional) — 提示信息


## modify_crond

修改已有计划任务的配置。

- **路由**：`POST /crontab`
- **action**：`modify_crond`

## 输入参数

| 参数名称 | 必选 | 类型 | 描述 |
|----------|------|------|------|
| action | 是 | String | 固定值 `modify_crond` |
| id | 是 | Integer | 任务 ID |
| name | 是 | String | 新任务名称 |
| type | 是 | String | 周期类型 |
| where1 | 是 | String | 周期值 |
| sType | 是 | String | 任务类型 |
| sBody | 是 | String | 执行内容 |
| sName | 否 | String | 备注 |

## 示例

```
POST /crontab HTTP/1.1
Content-Type: application/x-www-form-urlencoded

action=modify_crond&id=6&name=修改后任务&type=minute-n&where1=30&sType=toShell&sBody=echo updated&sName=
```

## 输出参数

| 参数名称 | 类型 | 描述 |
|----------|------|------|
| status | Boolean | 请求结果，`true` 表示成功 |
| msg | String | 提示信息 |

```json
{"status": true, "msg": "修改成功"}
```

