Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added REST api #2657

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
143 changes: 143 additions & 0 deletions docs/API.cn.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,143 @@
# API 文档

要向 REST API v2 发送请求,您需要在每个请求中包含带有 Bearer 类型的 Authorization 头和令牌。

```
Authorization: Bearer {token}
```

## Inbounds

### 获取所有 Inbounds
- **方法**: `GET`
- **端点**: `/inbounds/`
- **描述**: 获取所有 inbounds 的列表。

### 重置所有客户流量
- **方法**: `DELETE`
- **端点**: `/inbounds/traffic`
- **描述**: 重置所有客户的流量。

---

## Inbound

### 添加 Inbound
- **方法**: `POST`
- **端点**: `/inbounds/`
- **描述**: 添加新的 inbound。

### 通过 ID 获取 Inbound
- **方法**: `GET`
- **端点**: `/inbounds/:id`
- **描述**: 通过 ID 获取特定 inbound 的信息。

### 通过 ID 删除 Inbound
- **方法**: `DELETE`
- **端点**: `/inbounds/:id`
- **描述**: 通过 ID 删除 inbound。

### 通过 ID 更新 Inbound
- **方法**: `PUT`
- **端点**: `/inbounds/:id`
- **描述**: 通过 ID 更新 inbound 的信息。

### 删除 Inbound 流量
- **方法**: `DELETE`
- **端点**: `/inbounds/:id/traffic`
- **描述**: 通过 ID 删除 inbound 流量。

### 删除流量耗尽的客户
- **方法**: `DELETE`
- **端点**: `/inbounds/:id/depleted-clients`
- **描述**: 删除特定 inbound 下流量已耗尽的客户。

---

## Inbound 客户

### 获取 Inbound 客户
- **方法**: `GET`
- **端点**: `/inbounds/:id/clients/`
- **描述**: 获取特定 inbound 的客户列表。

---

## Inbound 客户管理

### 添加 Inbound 客户
- **方法**: `POST`
- **端点**: `/inbounds/:id/clients`
- **描述**: 向 inbound 添加新的客户。

### 通过 ID 获取客户
- **方法**: `GET`
- **端点**: `/inbounds/:id/clients/:clientId`
- **描述**: 通过 ID 获取客户信息。

### 更新 Inbound 客户
- **方法**: `PUT`
- **端点**: `/inbounds/:id/clients/:clientId`
- **描述**: 通过 ID 更新客户信息。

### 删除 Inbound 客户
- **方法**: `DELETE`
- **端点**: `/inbounds/:id/clients/:clientId`
- **描述**: 通过 ID 删除客户。

### 通过 ID 获取客户流量
- **方法**: `GET`
- **端点**: `/inbounds/:id/clients/:clientId/traffic`
- **描述**: 通过 ID 获取客户流量统计信息。

---

## 通过电子邮件管理客户

### 通过电子邮件获取客户
- **方法**: `GET`
- **端点**: `/inbounds/:id/clients/email/:email`
- **描述**: 通过电子邮件获取客户信息。

### 获取客户 IP 地址
- **方法**: `GET`
- **端点**: `/inbounds/:id/clients/email/:email/ips`
- **描述**: 通过电子邮件获取客户的 IP 地址列表。

### 清除客户 IP 地址
- **方法**: `DELETE`
- **端点**: `/inbounds/:id/clients/email/:email/ips`
- **描述**: 清除客户的 IP 地址列表。

### 通过电子邮件获取客户流量
- **方法**: `GET`
- **端点**: `/inbounds/:id/clients/email/:email/traffic`
- **描述**: 通过电子邮件获取客户流量统计信息。

### 通过电子邮件重置客户流量
- **方法**: `DELETE`
- **端点**: `/inbounds/:id/clients/email/:email/traffic`
- **描述**: 通过电子邮件重置客户流量。

---

## 其他功能

### 创建备份
- **方法**: `GET`
- **端点**: `/inbounds/create-backup`
- **描述**: 创建数据备份。

### 获取在线客户
- **方法**: `GET`
- **端点**: `/inbounds/online`
- **描述**: 获取在线客户列表。

---

## 服务器

### 获取服务器状态
- **方法**: `GET`
- **端点**: `/server/status`
- **描述**: 获取服务器状态。
143 changes: 143 additions & 0 deletions docs/API.en.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,143 @@
# API Documentation

To make requests to REST API v2, you need to include the Authorization header with the Bearer type and the token in each request.

```
Authorization: Bearer {token}
```

## Inbounds

### Get All Inbounds
- **Method**: `GET`
- **Endpoint**: `/inbounds/`
- **Description**: Retrieve a list of all inbounds.

### Reset All Client Traffic
- **Method**: `DELETE`
- **Endpoint**: `/inbounds/traffic`
- **Description**: Reset the traffic of all clients.

---

## Inbound

### Add Inbound
- **Method**: `POST`
- **Endpoint**: `/inbounds/`
- **Description**: Add a new inbound.

### Get Inbound by ID
- **Method**: `GET`
- **Endpoint**: `/inbounds/:id`
- **Description**: Retrieve information about a specific inbound by its ID.

### Delete Inbound by ID
- **Method**: `DELETE`
- **Endpoint**: `/inbounds/:id`
- **Description**: Delete an inbound by its ID.

### Update Inbound by ID
- **Method**: `PUT`
- **Endpoint**: `/inbounds/:id`
- **Description**: Update information about an inbound by its ID.

### Delete Inbound Traffic
- **Method**: `DELETE`
- **Endpoint**: `/inbounds/:id/traffic`
- **Description**: Delete traffic for an inbound by its ID.

### Delete Depleted Clients
- **Method**: `DELETE`
- **Endpoint**: `/inbounds/:id/depleted-clients`
- **Description**: Remove clients with exhausted traffic for a specific inbound.

---

## Inbound Clients

### Get Inbound Clients
- **Method**: `GET`
- **Endpoint**: `/inbounds/:id/clients/`
- **Description**: Retrieve a list of clients for a specific inbound.

---

## Inbound Client

### Add Inbound Client
- **Method**: `POST`
- **Endpoint**: `/inbounds/:id/clients`
- **Description**: Add a new client to an inbound.

### Get Client by ID
- **Method**: `GET`
- **Endpoint**: `/inbounds/:id/clients/:clientId`
- **Description**: Retrieve information about a client by its ID.

### Update Inbound Client
- **Method**: `PUT`
- **Endpoint**: `/inbounds/:id/clients/:clientId`
- **Description**: Update client information by its ID.

### Delete Inbound Client
- **Method**: `DELETE`
- **Endpoint**: `/inbounds/:id/clients/:clientId`
- **Description**: Delete a client by its ID.

### Get Client Traffic by ID
- **Method**: `GET`
- **Endpoint**: `/inbounds/:id/clients/:clientId/traffic`
- **Description**: Retrieve traffic statistics for a client by its ID.

---

## Inbound Client by Email

### Get Client by Email
- **Method**: `GET`
- **Endpoint**: `/inbounds/:id/clients/email/:email`
- **Description**: Retrieve client information by email.

### Get Client IPs
- **Method**: `GET`
- **Endpoint**: `/inbounds/:id/clients/email/:email/ips`
- **Description**: Retrieve a list of client IP addresses by email.

### Clear Client IPs
- **Method**: `DELETE`
- **Endpoint**: `/inbounds/:id/clients/email/:email/ips`
- **Description**: Clear the list of client IP addresses by email.

### Get Client Traffic by Email
- **Method**: `GET`
- **Endpoint**: `/inbounds/:id/clients/email/:email/traffic`
- **Description**: Retrieve traffic statistics for a client by email.

### Reset Client Traffic by Email
- **Method**: `DELETE`
- **Endpoint**: `/inbounds/:id/clients/email/:email/traffic`
- **Description**: Reset a client's traffic by email.

---

## Other

### Create Backup
- **Method**: `GET`
- **Endpoint**: `/inbounds/create-backup`
- **Description**: Create a data backup.

### Get Online Clients
- **Method**: `GET`
- **Endpoint**: `/inbounds/online`
- **Description**: Retrieve a list of online clients.

---

## Server

### Get Server Status
- **Method**: `GET`
- **Endpoint**: `/server/status`
- **Description**: Retrieve the server status.
Loading