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