Path: API › 计划任务

`POST /crontab`

将选中的计划任务归入指定的分类中。

## Request body

_Required._

- `action38.request_time` (string, required) — Unix 时间戳。
- `action38.request_token` (string, required) — 按 API 概览生成的签名。
- `action38.action` (string, required) — 具体操作名称。
  - one of `"set_crontab_type"`
- `action38.id` (integer, required) — 分类 ID
- `action38.crontab_ids` (string, required) — JSON 数组，任务 ID 列表 `[1,2,3]`

## Example request

```text
{
  "request_time": "string",
  "request_token": "string",
  "action": "set_crontab_type",
  "id": 0,
  "crontab_ids": "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=set_crontab_type" \
  --data-urlencode "id=<id>" \
  --data-urlencode "crontab_ids=<crontab_ids>"
```

## Responses

### default

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

#### Example

```json
{
  "status": true,
  "msg": "设置成功"
}
```


## set_crontab_type

将选中的计划任务归入指定的分类中。

**前置条件**：需先通过 [add_crontab_type](/api/crontab/add_crontab_type) 创建分类。

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

## 输入参数

| 参数名称 | 必选 | 类型 | 描述 |
|----------|------|------|------|
| action | 是 | String | 固定值 `set_crontab_type` |
| id | 是 | Integer | 分类 ID |
| crontab_ids | 是 | String | JSON 数组，任务 ID 列表 `[1,2,3]` |

## 示例

```json
{"status": true, "msg": "设置成功"}
```

## 相关接口

- [add_crontab_type](/api/crontab/add_crontab_type) — 创建分类
- [get_crontab_types](/api/crontab/get_crontab_types) — 查看分类列表

