Path: API › 计划任务

`POST /crontab`

获取面板中所有计划任务的完整列表，包含任务配置、状态、执行周期等信息。

## Request body

_Required._

- `action11.request_time` (string, required) — Unix 时间戳。
- `action11.request_token` (string, required) — 按 API 概览生成的签名。
- `action11.action` (string, required) — 具体操作名称。
  - one of `"GetCrontab"`

## Example request

```text
{
  "request_time": "string",
  "request_token": "string",
  "action": "GetCrontab"
}
```

## 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=GetCrontab"
```

## Responses

### default

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

#### Example

```json
[
  {
    "id": 1,
    "name": "续签Let's Encrypt证书",
    "type": "day",
    "where_hour": 10,
    "where_minute": 15,
    "status": 1,
    "sType": "toShell"
  }
]
```

- `action11.response.default.id` (integer, optional) — 任务 ID
- `action11.response.default.name` (string, optional) — 任务名称
- `action11.response.default.type` (string, optional) — 周期类型：`day`、`minute-n`、`hour`、`week`、`month`
- `action11.response.default.where1` (string, optional) — 周期值（天数/分钟数）
- `action11.response.default.where_hour` (integer, optional) — 执行小时
- `action11.response.default.where_minute` (integer, optional) — 执行分钟
- `action11.response.default.status` (integer, optional) — `1` = 启用，`0` = 暂停
- `action11.response.default.sType` (string, optional) — 任务类型：`toShell`、`toUrl`、`site`、`database`、`logs`
- `action11.response.default.sBody` (string, optional) — 执行内容
- `action11.response.default.echo` (string, optional) — 唯一标识符
- `action11.response.default.save` (integer, optional) — 备份保留份数


## GetCrontab

获取面板中所有计划任务的完整列表，包含任务配置、状态、执行周期等信息。

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

## 输入参数

| 参数名称 | 必选 | 类型 | 描述 |
|----------|------|------|------|
| action | 是 | String | 固定值 `GetCrontab` |

## 输出参数

返回数组，每项：

| 参数名称 | 类型 | 描述 |
|----------|------|------|
| id | Integer | 任务 ID |
| name | String | 任务名称 |
| type | String | 周期类型：`day`、`minute-n`、`hour`、`week`、`month` |
| where1 | String | 周期值（天数/分钟数） |
| where_hour | Integer | 执行小时 |
| where_minute | Integer | 执行分钟 |
| status | Integer | `1` = 启用，`0` = 暂停 |
| sType | String | 任务类型：`toShell`、`toUrl`、`site`、`database`、`logs` |
| sBody | String | 执行内容 |
| echo | String | 唯一标识符 |
| save | Integer | 备份保留份数 |

## 示例

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

request_time=1700000000&request_token=xxx&action=GetCrontab
```

```json
[{
    "id": 1,
    "name": "续签Let's Encrypt证书",
    "type": "day",
    "where_hour": 10,
    "where_minute": 15,
    "status": 1,
    "sType": "toShell"
}]
```

