Path: API › 网站管理

`POST /site`

获取指定网站的目录密码保护（HTTP Basic Auth）配置列表。

## Request body

_Required._

- `request_time` (`action282.request_time`; string, required) — Unix 时间戳。
- `request_token` (`action282.request_token`; string, required) — 按 API 概览生成的签名。
- `action` (`action282.action`; string, required) — 具体操作名称。
  - one of `"get_dir_auth"`
- `id` (`action282.id`; integer, optional) — 网站 ID
- `siteName` (`action282.siteName`; string, optional) — 网站域名（与 id 二选一）

## Example request

```text
{
  "request_time": "string",
  "request_token": "string",
  "action": "get_dir_auth",
  "id": 0,
  "siteName": "string"
}
```

## Code samples

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

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

## Responses

### default

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

#### Example

```json
{
  "testapi.bt.local": []
}
```


## get_dir_auth

获取指定网站的目录密码保护（HTTP Basic Auth）配置列表。

- **路由**：`POST /site`
- **action**：`get_dir_auth`

## 输入参数

| 参数名称 | 必选 | 类型 | 描述 |
|----------|------|------|------|
| action | 是 | String | 固定值 `get_dir_auth` |
| id | 否 | Integer | 网站 ID |
| siteName | 否 | String | 网站域名（与 id 二选一） |

## 输出参数

| 参数名称 | 类型 | 描述 |
|----------|------|------|
| - | Object | 以域名为 key 的目录保护配置对象 |

## 示例

### 请求

```
POST /site HTTP/1.1
Host: 192.168.168.213:8888
Content-Type: application/x-www-form-urlencoded

action=get_dir_auth&id=1
```

### 响应

```json
{"testapi.bt.local": []}
```

> 空数组表示该站点暂无目录保护配置。

