docs: hardcode curl examples, remove shell vars

This commit is contained in:
Warren
2026-05-08 10:58:06 +08:00
parent bb3505c91b
commit b63fe58751

View File

@@ -16,20 +16,10 @@ owner: "Warren"
| Environment | URL |
|-------------|-----|
| Production | `$BASE` or `https://api.momentry.ddns.net` |
| Production | `http://localhost:3002` or `https://api.momentry.ddns.net` |
| Development | `http://localhost:3003` |
| Auth | Header `X-API-Key: <key>` (login endpoint unprotected) |
### Quick Setup (copy-paste once)
```bash
BASE=http://localhost:3002
KEY="X-API-Key: muser_68600856036340bcafc01930eb4bd839_1774418104_97221b69"
FILE=3abeee81d94597629ed8cb943f182e94
```
All curl examples below use `$BASE`, `$KEY`, `$FILE`. After running the setup above, you can copy-paste each example directly.
---
## 1. System
@@ -46,7 +36,7 @@ All curl examples below use `$BASE`, `$KEY`, `$FILE`. After running the setup ab
| 8 | POST | `/api/v1/config/cache` | Toggle Redis cache |
```bash
curl $BASE/health
curl http://localhost:3002/health
```
```json
{"status":"ok","version":"1.0.0","uptime_ms":7052517}
@@ -70,17 +60,17 @@ curl $BASE/health
| 18 | GET | `/api/v1/jobs` | Monitor jobs (filterable) |
```bash
curl -X POST $BASE/api/v1/files/register \
-H "$KEY" \
curl -X POST http://localhost:3002/api/v1/files/register \
-H "X-API-Key: muser_68600856036340bcafc01930eb4bd839_1774418104_97221b69" \
-H "Content-Type: application/json" \
-d '{"file_path":"/sftpgo/data/demo/video.mp4"}'
```
```json
{"success":true,"file_uuid":"$FILE","duration":5954.0}
{"success":true,"file_uuid":"3abeee81d94597629ed8cb943f182e94","duration":5954.0}
```
```bash
curl "$BASE/api/v1/files?page=1&page_size=2" -H "$KEY"
curl "http://localhost:3002/api/v1/files?page=1&page_size=2" -H "X-API-Key: muser_68600856036340bcafc01930eb4bd839_1774418104_97221b69"
```
```json
{"files":[{"file_name":"Charade (1963)..."}],"total":37}
@@ -102,20 +92,20 @@ curl "$BASE/api/v1/files?page=1&page_size=2" -H "$KEY"
| 26 | POST | `/api/v1/search/frames` | Frame-level search |
```bash
curl -X POST $BASE/api/v1/search/universal \
-H "$KEY" \
curl -X POST http://localhost:3002/api/v1/search/universal \
-H "X-API-Key: muser_68600856036340bcafc01930eb4bd839_1774418104_97221b69" \
-H "Content-Type: application/json" \
-d '{"query":"name","limit":2,"mode":"bm25","uuid":"$FILE"}'
-d '{"query":"name","limit":2,"mode":"bm25","uuid":"3abeee81d94597629ed8cb943f182e94"}'
```
```json
{"count":1,"results":[{"text":"What's your name?","score":0.90}]}
```
```bash
curl -X POST $BASE/api/v1/search/universal \
-H "$KEY" \
curl -X POST http://localhost:3002/api/v1/search/universal \
-H "X-API-Key: muser_68600856036340bcafc01930eb4bd839_1774418104_97221b69" \
-H "Content-Type: application/json" \
-d '{"query":"friends","limit":2,"mode":"bm25","uuid":"$FILE"}'
-d '{"query":"friends","limit":2,"mode":"bm25","uuid":"3abeee81d94597629ed8cb943f182e94"}'
```
```json
{"count":1,"results":[{"text":"You won't find it difficult to make some new friends.","score":0.90}]}
@@ -138,8 +128,8 @@ Parameters:
- `limit`: max results
```bash
curl -X POST "$BASE/api/v1/file/$FILE/face_trace/sortby" \
-H "$KEY" \
curl -X POST "http://localhost:3002/api/v1/file/3abeee81d94597629ed8cb943f182e94/face_trace/sortby" \
-H "X-API-Key: muser_68600856036340bcafc01930eb4bd839_1774418104_97221b69" \
-H "Content-Type: application/json" \
-d '{"sort_by":"face_count","limit":2}'
```
@@ -157,8 +147,8 @@ Parameters:
- `interpolate`: boolean (fills sparse gaps with lerp bbox)
```bash
curl "$BASE/api/v1/file/$FILE/trace/2/faces?limit=2&interpolate=true" \
-H "$KEY"
curl "http://localhost:3002/api/v1/file/3abeee81d94597629ed8cb943f182e94/trace/2/faces?limit=2&interpolate=true" \
-H "X-API-Key: muser_68600856036340bcafc01930eb4bd839_1774418104_97221b69"
```
```json
{"success":true,"trace_id":2,"total":1,"faces":[
@@ -178,14 +168,14 @@ curl "$BASE/api/v1/file/$FILE/trace/2/faces?limit=2&interpolate=true" \
| 32 | GET | `/api/v1/file/:file_uuid/trace/:trace_id/video` | Trace clip (?padding=) |
```bash
curl -o thumb.jpg "$BASE/api/v1/file/$FILE/thumbnail?frame=4650" \
-H "$KEY"
curl -o thumb.jpg "http://localhost:3002/api/v1/file/3abeee81d94597629ed8cb943f182e94/thumbnail?frame=4650" \
-H "X-API-Key: muser_68600856036340bcafc01930eb4bd839_1774418104_97221b69"
```
Returns JPEG binary (82KB, 1920×1080).
```bash
curl -o trace_clip.mp4 "$BASE/api/v1/file/$FILE/trace/2/video" \
-H "$KEY"
curl -o trace_clip.mp4 "http://localhost:3002/api/v1/file/3abeee81d94597629ed8cb943f182e94/trace/2/video" \
-H "X-API-Key: muser_68600856036340bcafc01930eb4bd839_1774418104_97221b69"
```
Returns MP4 video binary (3.0MB) with bbox overlay.
@@ -205,8 +195,8 @@ Returns MP4 video binary (3.0MB) with bbox overlay.
| 40 | GET | `/api/v1/faces/candidates` | Unbound face gallery |
```bash
curl "$BASE/api/v1/identities?page=1&page_size=3" \
-H "$KEY"
curl "http://localhost:3002/api/v1/identities?page=1&page_size=3" \
-H "X-API-Key: muser_68600856036340bcafc01930eb4bd839_1774418104_97221b69"
```
```json
{"identities":[
@@ -217,8 +207,8 @@ curl "$BASE/api/v1/identities?page=1&page_size=3" \
```
```bash
curl "$BASE/api/v1/faces/candidates?page=1&page_size=2" \
-H "$KEY"
curl "http://localhost:3002/api/v1/faces/candidates?page=1&page_size=2" \
-H "X-API-Key: muser_68600856036340bcafc01930eb4bd839_1774418104_97221b69"
```
```json
{"total":42,"candidates":[{"frame_number":30,"confidence":0.85},...]}
@@ -235,10 +225,10 @@ curl "$BASE/api/v1/faces/candidates?page=1&page_size=2" \
| 43 | POST | `/api/v1/identity/:from_uuid/mergeinto` | Merge two identities |
```bash
curl -X POST "$BASE/api/v1/identity/a9a90105-6d6b-46ff-92da-0c3c1a57dff4/bind" \
-H "$KEY" \
curl -X POST "http://localhost:3002/api/v1/identity/a9a90105-6d6b-46ff-92da-0c3c1a57dff4/bind" \
-H "X-API-Key: muser_68600856036340bcafc01930eb4bd839_1774418104_97221b69" \
-H "Content-Type: application/json" \
-d '{"file_uuid":"$FILE","face_id":"face_42"}'
-d '{"file_uuid":"3abeee81d94597629ed8cb943f182e94","face_id":"face_42"}'
```
```json
{"success":true}
@@ -255,8 +245,8 @@ curl -X POST "$BASE/api/v1/identity/a9a90105-6d6b-46ff-92da-0c3c1a57dff4/bind" \
| 46 | GET | `/api/v1/resources` | List all resources |
```bash
curl "$BASE/api/v1/resources" \
-H "$KEY"
curl "http://localhost:3002/api/v1/resources" \
-H "X-API-Key: muser_68600856036340bcafc01930eb4bd839_1774418104_97221b69"
```
```json
{"resources":[{"resource_id":"mxbai-embed-large-v1","resource_type":"embedding_model"}]}
@@ -274,8 +264,8 @@ curl "$BASE/api/v1/resources" \
| 50 | GET | `/api/v1/agents/5w1h/status` | Job status |
```bash
curl -X POST "$BASE/api/v1/agents/translate" \
-H "$KEY" \
curl -X POST "http://localhost:3002/api/v1/agents/translate" \
-H "X-API-Key: muser_68600856036340bcafc01930eb4bd839_1774418104_97221b69" \
-H "Content-Type: application/json" \
-d '{"text":"Hello world","target_language":"zh-TW"}'
```