[新增] 同步更新英文版文档

This commit is contained in:
ryan
2026-05-28 23:00:48 +08:00
parent 95d58eb724
commit b0117b7c84
11 changed files with 870 additions and 121 deletions
+15 -11
View File
@@ -1,10 +1,12 @@
# API Conventions
Management API and Agent API both use JSON.
You will learn: The response structure, path conventions, authentication methods, and Swagger entry point for OpenFlare management and Agent APIs.
## Response Shape
Both the OpenFlare management APIs and Agent APIs use JSON.
Success and failure responses should include a clear `message`:
## Response Structure
Both success and failure should return a clear `message`:
```json
{
@@ -14,31 +16,33 @@ Success and failure responses should include a clear `message`:
}
```
## Paths
## Path Conventions
| Type | Convention |
| --- | --- |
| Management API | Authenticated by management Session |
| Management API | Authenticated by management console Session |
| Agent API | Fixed under `/api/agent/*` |
| Read-only endpoints | `GET` |
| Mutating endpoints | `POST` |
| Read-only API | Use `GET` |
| Mutation-type API | Use `POST` |
## Authentication
Management endpoints reuse the existing login, role, and Session system.
The management console continues to reuse the existing login, role, and Session system.
Agent requests use the node-specific `agent_token`. First-time registration can use a global `discovery_token`. The header is:
Official Agent requests uniformly use the node-exclusive `agent_token`; the first access can use the global `discovery_token`. The Agent request header is fixed as:
```http
X-Agent-Token: <token>
```
Do not log full tokens.
Full Tokens must not be printed in the logs.
## Swagger
After logging in:
Accessible after logging into the management console:
```text
/swagger/index.html
```
The Swagger files are located in `openflare_server/docs`, generated by `swag init`.