mirror of
https://github.com/Rain-kl/OpenFlare.git
synced 2026-10-07 08:06:37 +08:00
[新增] 同步更新英文版文档
This commit is contained in:
+15
-11
@@ -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`.
|
||||
|
||||
Reference in New Issue
Block a user