Resumable Uploads
Resumable Uploads
Litmus Edge uses a three-step resumable upload pattern for any operation that ingests a file: templates, backups, certificates, analytics models. The pattern is the same; only the path changes.
The pattern
Phase | Method | What it does | Body |
|---|---|---|---|
0. Clear | DELETE | Remove any incomplete/stale upload session | none |
1. Create session | POST | Declare file size, get a session id back | {"size": <bytes>} |
2. Upload | PUT | Stream the file bytes into the session | binary file body |
Endpoints that use it
Workflow | Base path | Page |
|---|---|---|
Apply / Upload Template | /dm/template/v2 | |
Restore Backup | /dm/backup/v2 | |
Upload Custom CA | /dm/certstore (no DELETE step) | |
Upload Analytics Model | /analytics/v2/upload_model/v2 |
Step 2 (PUT) URL shapes
The PUT URL is slightly different per module:
Module | PUT URL shape |
|---|---|
Template | /dm/template/v2/{session_id}/resume |
Backup | /dm/backup/v2/{session_id}/resume |
Cert store | /dm/certstore/{session_id} (no /resume suffix) |
Analytics model | /analytics/v2/upload_model/v2/resume/{session_id} |
Example: apply a template
# Step 0: clear any stale session
curl -X DELETE "$EDGE/dm/template/v2" \
-H "Authorization: Bearer $TOKEN"
# Step 1: declare size
SIZE=$(stat -c%s mytemplate.zip)
ID=$(curl -sX POST "$EDGE/dm/template/v2" \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d "{\"size\": $SIZE}" | jq -r .id)
# Step 2: upload bytes
curl -X PUT "$EDGE/dm/template/v2/$ID/resume" \
-H "Authorization: Bearer $TOKEN" \
--data-binary @mytemplate.zipLEM uploads are different
LEM does not use this pattern. LEM ML model upload uses a pre-signed S3 URL:
- POST .../mlModel/{filename}/upload-url returns a signed S3 URL
- PUT <signed url> uploads bytes directly to S3 (no auth header needed - SigV4 is baked into the URL)
- POST .../mlModel/{filename} commits / registers the model in LEM