Path: API › FTP 管理

`POST /ftp`

修改 Pure-FTPd 的监听端口，并自动更新防火墙规则。

## Request body

_Required._

- `action159.request_time` (string, required) — Unix 时间戳。
- `action159.request_token` (string, required) — 按 API 概览生成的签名。
- `action159.action` (string, required) — 具体操作名称。
  - one of `"setPort"`
- `action159.port` (integer, required) — 新端口号

## Example request

```text
{
  "request_time": "string",
  "request_token": "string",
  "action": "setPort",
  "port": 0
}
```

## Code samples

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

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

## Responses

### default

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

#### Example

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

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


## setPort

修改 Pure-FTPd 的监听端口，并自动更新防火墙规则。

- **路由**：`POST /ftp`
- **action**：`setPort`

## 输入参数

| 参数名称 | 必选 | 类型 | 描述 |
|----------|------|------|------|
| action | 是 | String | 固定值 `setPort` |
| port | 是 | Integer | 新端口号 |

## 示例

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

action=setPort&port=21
```

## 输出参数

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

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

