diff --git a/docs_v1.0/API_V1.0.0/RELEASE/RELEASE_API_REFERENCE_v1.0.0.md b/docs_v1.0/API_V1.0.0/RELEASE/RELEASE_API_REFERENCE_v1.0.0.md index a7089ae..8e4ed65 100644 --- a/docs_v1.0/API_V1.0.0/RELEASE/RELEASE_API_REFERENCE_v1.0.0.md +++ b/docs_v1.0/API_V1.0.0/RELEASE/RELEASE_API_REFERENCE_v1.0.0.md @@ -16,10 +16,20 @@ owner: "Warren" | Environment | URL | |-------------|-----| -| Production | `http://localhost:3002` or `https://api.momentry.ddns.net` | +| Production | `$BASE` or `https://api.momentry.ddns.net` | | Development | `http://localhost:3003` | | Auth | Header `X-API-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 @@ -36,7 +46,7 @@ owner: "Warren" | 8 | POST | `/api/v1/config/cache` | Toggle Redis cache | ```bash -curl http://localhost:3002/health +curl $BASE/health ``` ```json {"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) | ```bash -curl -X POST http://localhost:3002/api/v1/files/register \ - -H "X-API-Key: muser_test_apikey" \ +curl -X POST $BASE/api/v1/files/register \ + -H "$KEY" \ -H "Content-Type: application/json" \ -d '{"file_path":"/sftpgo/data/demo/video.mp4"}' ``` ```json -{"success":true,"file_uuid":"3abeee81d94597629ed8cb943f182e94","duration":5954.0} +{"success":true,"file_uuid":"$FILE","duration":5954.0} ``` ```bash -curl "http://localhost:3002/api/v1/files?page=1&page_size=2" \ - -H "X-API-Key: muser_test_apikey" +curl "$BASE/api/v1/files?page=1&page_size=2" -H "$KEY" ``` ```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 | ```bash -curl -X POST http://localhost:3002/api/v1/search/universal \ - -H "X-API-Key: muser_test_apikey" \ +curl -X POST $BASE/api/v1/search/universal \ + -H "$KEY" \ -H "Content-Type: application/json" \ - -d '{"query":"name","limit":2,"mode":"bm25","uuid":"3abeee81d94597629ed8cb943f182e94"}' + -d '{"query":"name","limit":2,"mode":"bm25","uuid":"$FILE"}' ``` ```json {"count":1,"results":[{"text":"What's your name?","score":0.90}]} ``` ```bash -curl -X POST http://localhost:3002/api/v1/search/universal \ - -H "X-API-Key: muser_test_apikey" \ +curl -X POST $BASE/api/v1/search/universal \ + -H "$KEY" \ -H "Content-Type: application/json" \ - -d '{"query":"friends","limit":2,"mode":"bm25","uuid":"3abeee81d94597629ed8cb943f182e94"}' + -d '{"query":"friends","limit":2,"mode":"bm25","uuid":"$FILE"}' ``` ```json {"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 ```bash -curl -X POST "http://localhost:3002/api/v1/file/3abeee81d94597629ed8cb943f182e94/face_trace/sortby" \ - -H "X-API-Key: muser_test_apikey" \ +curl -X POST "$BASE/api/v1/file/$FILE/face_trace/sortby" \ + -H "$KEY" \ -H "Content-Type: application/json" \ -d '{"sort_by":"face_count","limit":2}' ``` @@ -148,8 +157,8 @@ Parameters: - `interpolate`: boolean (fills sparse gaps with lerp bbox) ```bash -curl "http://localhost:3002/api/v1/file/3abeee81d94597629ed8cb943f182e94/trace/2/faces?limit=2&interpolate=true" \ - -H "X-API-Key: muser_test_apikey" +curl "$BASE/api/v1/file/$FILE/trace/2/faces?limit=2&interpolate=true" \ + -H "$KEY" ``` ```json {"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=) | ```bash -curl -o thumb.jpg "http://localhost:3002/api/v1/file/3abeee81.../thumbnail?frame=4650" \ - -H "X-API-Key: muser_test_apikey" +curl -o thumb.jpg "$BASE/api/v1/file/$FILE/thumbnail?frame=4650" \ + -H "$KEY" ``` Returns JPEG binary (82KB, 1920×1080). ```bash -curl -o trace_clip.mp4 "http://localhost:3002/api/v1/file/3abeee81.../trace/2/video" \ - -H "X-API-Key: muser_test_apikey" +curl -o trace_clip.mp4 "$BASE/api/v1/file/$FILE/trace/2/video" \ + -H "$KEY" ``` 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 | ```bash -curl "http://localhost:3002/api/v1/identities?page=1&page_size=3" \ - -H "X-API-Key: muser_test_apikey" +curl "$BASE/api/v1/identities?page=1&page_size=3" \ + -H "$KEY" ``` ```json {"identities":[ @@ -208,8 +217,8 @@ curl "http://localhost:3002/api/v1/identities?page=1&page_size=3" \ ``` ```bash -curl "http://localhost:3002/api/v1/faces/candidates?page=1&page_size=2" \ - -H "X-API-Key: muser_test_apikey" +curl "$BASE/api/v1/faces/candidates?page=1&page_size=2" \ + -H "$KEY" ``` ```json {"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 | ```bash -curl -X POST "http://localhost:3002/api/v1/identity/a9a90105-6d6b-46ff-92da-0c3c1a57dff4/bind" \ - -H "X-API-Key: muser_test_apikey" \ +curl -X POST "$BASE/api/v1/identity/a9a90105-6d6b-46ff-92da-0c3c1a57dff4/bind" \ + -H "$KEY" \ -H "Content-Type: application/json" \ - -d '{"file_uuid":"3abeee81d94597629ed8cb943f182e94","face_id":"face_42"}' + -d '{"file_uuid":"$FILE","face_id":"face_42"}' ``` ```json {"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 | ```bash -curl "http://localhost:3002/api/v1/resources" \ - -H "X-API-Key: muser_test_apikey" +curl "$BASE/api/v1/resources" \ + -H "$KEY" ``` ```json {"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 | ```bash -curl -X POST "http://localhost:3002/api/v1/agents/translate" \ - -H "X-API-Key: muser_test_apikey" \ +curl -X POST "$BASE/api/v1/agents/translate" \ + -H "$KEY" \ -H "Content-Type: application/json" \ -d '{"text":"Hello world","target_language":"zh-TW"}' ```