docs: make curl commands directly copy-pasteable with shell vars
This commit is contained in:
@@ -16,10 +16,20 @@ owner: "Warren"
|
|||||||
|
|
||||||
| Environment | URL |
|
| Environment | URL |
|
||||||
|-------------|-----|
|
|-------------|-----|
|
||||||
| Production | `http://localhost:3002` or `https://api.momentry.ddns.net` |
|
| Production | `$BASE` 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_test_apikey"
|
||||||
|
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
|
||||||
@@ -36,7 +46,7 @@ owner: "Warren"
|
|||||||
| 8 | POST | `/api/v1/config/cache` | Toggle Redis cache |
|
| 8 | POST | `/api/v1/config/cache` | Toggle Redis cache |
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
curl http://localhost:3002/health
|
curl $BASE/health
|
||||||
```
|
```
|
||||||
```json
|
```json
|
||||||
{"status":"ok","version":"1.0.0","uptime_ms":7052517}
|
{"status":"ok","version":"1.0.0","uptime_ms":7052517}
|
||||||
@@ -60,21 +70,20 @@ curl http://localhost:3002/health
|
|||||||
| 18 | GET | `/api/v1/jobs` | Monitor jobs (filterable) |
|
| 18 | GET | `/api/v1/jobs` | Monitor jobs (filterable) |
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
curl -X POST http://localhost:3002/api/v1/files/register \
|
curl -X POST $BASE/api/v1/files/register \
|
||||||
-H "X-API-Key: muser_test_apikey" \
|
-H "$KEY" \
|
||||||
-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":"3abeee81d94597629ed8cb943f182e94","duration":5954.0}
|
{"success":true,"file_uuid":"$FILE","duration":5954.0}
|
||||||
```
|
```
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
curl "http://localhost:3002/api/v1/files?page=1&page_size=2" \
|
curl "$BASE/api/v1/files?page=1&page_size=2" -H "$KEY"
|
||||||
-H "X-API-Key: muser_test_apikey"
|
|
||||||
```
|
```
|
||||||
```json
|
```json
|
||||||
{"files":[{"file_name":"Charade (1963)..."},{"file_name":"view13.mp4"}],"total":37}
|
{"files":[{"file_name":"Charade (1963)..."}],"total":37}
|
||||||
```
|
```
|
||||||
|
|
||||||
---
|
---
|
||||||
@@ -93,20 +102,20 @@ curl "http://localhost:3002/api/v1/files?page=1&page_size=2" \
|
|||||||
| 26 | POST | `/api/v1/search/frames` | Frame-level search |
|
| 26 | POST | `/api/v1/search/frames` | Frame-level search |
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
curl -X POST http://localhost:3002/api/v1/search/universal \
|
curl -X POST $BASE/api/v1/search/universal \
|
||||||
-H "X-API-Key: muser_test_apikey" \
|
-H "$KEY" \
|
||||||
-H "Content-Type: application/json" \
|
-H "Content-Type: application/json" \
|
||||||
-d '{"query":"name","limit":2,"mode":"bm25","uuid":"3abeee81d94597629ed8cb943f182e94"}'
|
-d '{"query":"name","limit":2,"mode":"bm25","uuid":"$FILE"}'
|
||||||
```
|
```
|
||||||
```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 http://localhost:3002/api/v1/search/universal \
|
curl -X POST $BASE/api/v1/search/universal \
|
||||||
-H "X-API-Key: muser_test_apikey" \
|
-H "$KEY" \
|
||||||
-H "Content-Type: application/json" \
|
-H "Content-Type: application/json" \
|
||||||
-d '{"query":"friends","limit":2,"mode":"bm25","uuid":"3abeee81d94597629ed8cb943f182e94"}'
|
-d '{"query":"friends","limit":2,"mode":"bm25","uuid":"$FILE"}'
|
||||||
```
|
```
|
||||||
```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}]}
|
||||||
@@ -129,8 +138,8 @@ Parameters:
|
|||||||
- `limit`: max results
|
- `limit`: max results
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
curl -X POST "http://localhost:3002/api/v1/file/3abeee81d94597629ed8cb943f182e94/face_trace/sortby" \
|
curl -X POST "$BASE/api/v1/file/$FILE/face_trace/sortby" \
|
||||||
-H "X-API-Key: muser_test_apikey" \
|
-H "$KEY" \
|
||||||
-H "Content-Type: application/json" \
|
-H "Content-Type: application/json" \
|
||||||
-d '{"sort_by":"face_count","limit":2}'
|
-d '{"sort_by":"face_count","limit":2}'
|
||||||
```
|
```
|
||||||
@@ -148,8 +157,8 @@ Parameters:
|
|||||||
- `interpolate`: boolean (fills sparse gaps with lerp bbox)
|
- `interpolate`: boolean (fills sparse gaps with lerp bbox)
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
curl "http://localhost:3002/api/v1/file/3abeee81d94597629ed8cb943f182e94/trace/2/faces?limit=2&interpolate=true" \
|
curl "$BASE/api/v1/file/$FILE/trace/2/faces?limit=2&interpolate=true" \
|
||||||
-H "X-API-Key: muser_test_apikey"
|
-H "$KEY"
|
||||||
```
|
```
|
||||||
```json
|
```json
|
||||||
{"success":true,"trace_id":2,"total":1,"faces":[
|
{"success":true,"trace_id":2,"total":1,"faces":[
|
||||||
@@ -169,14 +178,14 @@ curl "http://localhost:3002/api/v1/file/3abeee81d94597629ed8cb943f182e94/trace/2
|
|||||||
| 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 "http://localhost:3002/api/v1/file/3abeee81.../thumbnail?frame=4650" \
|
curl -o thumb.jpg "$BASE/api/v1/file/$FILE/thumbnail?frame=4650" \
|
||||||
-H "X-API-Key: muser_test_apikey"
|
-H "$KEY"
|
||||||
```
|
```
|
||||||
Returns JPEG binary (82KB, 1920×1080).
|
Returns JPEG binary (82KB, 1920×1080).
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
curl -o trace_clip.mp4 "http://localhost:3002/api/v1/file/3abeee81.../trace/2/video" \
|
curl -o trace_clip.mp4 "$BASE/api/v1/file/$FILE/trace/2/video" \
|
||||||
-H "X-API-Key: muser_test_apikey"
|
-H "$KEY"
|
||||||
```
|
```
|
||||||
Returns MP4 video binary (3.0MB) with bbox overlay.
|
Returns MP4 video binary (3.0MB) with bbox overlay.
|
||||||
|
|
||||||
@@ -196,8 +205,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 "http://localhost:3002/api/v1/identities?page=1&page_size=3" \
|
curl "$BASE/api/v1/identities?page=1&page_size=3" \
|
||||||
-H "X-API-Key: muser_test_apikey"
|
-H "$KEY"
|
||||||
```
|
```
|
||||||
```json
|
```json
|
||||||
{"identities":[
|
{"identities":[
|
||||||
@@ -208,8 +217,8 @@ curl "http://localhost:3002/api/v1/identities?page=1&page_size=3" \
|
|||||||
```
|
```
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
curl "http://localhost:3002/api/v1/faces/candidates?page=1&page_size=2" \
|
curl "$BASE/api/v1/faces/candidates?page=1&page_size=2" \
|
||||||
-H "X-API-Key: muser_test_apikey"
|
-H "$KEY"
|
||||||
```
|
```
|
||||||
```json
|
```json
|
||||||
{"total":42,"candidates":[{"frame_number":30,"confidence":0.85},...]}
|
{"total":42,"candidates":[{"frame_number":30,"confidence":0.85},...]}
|
||||||
@@ -226,10 +235,10 @@ curl "http://localhost:3002/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 "http://localhost:3002/api/v1/identity/a9a90105-6d6b-46ff-92da-0c3c1a57dff4/bind" \
|
curl -X POST "$BASE/api/v1/identity/a9a90105-6d6b-46ff-92da-0c3c1a57dff4/bind" \
|
||||||
-H "X-API-Key: muser_test_apikey" \
|
-H "$KEY" \
|
||||||
-H "Content-Type: application/json" \
|
-H "Content-Type: application/json" \
|
||||||
-d '{"file_uuid":"3abeee81d94597629ed8cb943f182e94","face_id":"face_42"}'
|
-d '{"file_uuid":"$FILE","face_id":"face_42"}'
|
||||||
```
|
```
|
||||||
```json
|
```json
|
||||||
{"success":true}
|
{"success":true}
|
||||||
@@ -246,8 +255,8 @@ curl -X POST "http://localhost:3002/api/v1/identity/a9a90105-6d6b-46ff-92da-0c3c
|
|||||||
| 46 | GET | `/api/v1/resources` | List all resources |
|
| 46 | GET | `/api/v1/resources` | List all resources |
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
curl "http://localhost:3002/api/v1/resources" \
|
curl "$BASE/api/v1/resources" \
|
||||||
-H "X-API-Key: muser_test_apikey"
|
-H "$KEY"
|
||||||
```
|
```
|
||||||
```json
|
```json
|
||||||
{"resources":[{"resource_id":"mxbai-embed-large-v1","resource_type":"embedding_model"}]}
|
{"resources":[{"resource_id":"mxbai-embed-large-v1","resource_type":"embedding_model"}]}
|
||||||
@@ -265,8 +274,8 @@ curl "http://localhost:3002/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 "http://localhost:3002/api/v1/agents/translate" \
|
curl -X POST "$BASE/api/v1/agents/translate" \
|
||||||
-H "X-API-Key: muser_test_apikey" \
|
-H "$KEY" \
|
||||||
-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"}'
|
||||||
```
|
```
|
||||||
|
|||||||
Reference in New Issue
Block a user