parent: /workflows/agents.md back_out_url: /workflows/agents.md


Workflow 1: Apply / Upload Template (LE)

You are at https://api.litmus.io/workflows/apply-upload-template.md Parent: https://api.litmus.io/workflows/agents.md If this is the wrong workflow, back out to the index above.

1. Apply / Upload Template (LE)

UI trigger: System -> Device Management -> Templates -> Apply Template (downloads a template file, then re-uploads it)

LE 4.0.x: this workflow uses the current /config/template API. The older /dm/template flow still works (collection folder Old method of template apply) but is deprecated -- see the bottom of this page.

What the UI does invisibly: when a user applies a template, the UI creates an upload session sized to the file, uploads the bytes, then commits the apply -- the user just sees a file download/upload dialog.

Sensitive data: a downloaded template embeds live secrets (account APIKeys, connector credentials, certificates). Treat the file as a secret.

Download a template (current method)

Step Name in Collection Method Endpoint Body / Notes Output
a List Configuration Template Inventory GET {{edgeUrl}}/config/template No body. Lists exportable items per subsystem. Inventory of {id, name} refs
b Download Configuration Template POST {{edgeUrl}}/config/template JSON with chosen refs per category ({id,name} objects copied from the inventory; {type,name} for opcua). Always send the five arrays accounts, connectors, devices, flows, opcua (use [] for ones you skip). Template bundle JSON -- save to a file

Apply a template (current method)

Three-call resumable (tus-style) upload: create session -> upload bytes -> apply.

Step Name in Collection Method Endpoint Body / Notes Output
1 Step 1: Create Apply Session POST {{edgeUrl}}/config/session {"size": <file_bytes>} {"id": "<session_id>", "size": N, "offset": 0} -- save id as {{config_session_id}}
2 Step 2: Upload Template to Session PATCH {{edgeUrl}}/config/session/{{config_session_id}} multipart/form-data, single file part (application/octet-stream, filename blob). Headers: Upload-Length: <size>, Upload-Offset: 0. Resumable -- repeat with the returned offset until offset == size. {"id", "size", "offset"}
3 Step 3: Apply Uploaded Template PUT {{edgeUrl}}/config/template/{{config_session_id}} {} (empty object applies the whole template). Mutating -- overwrites/merges live config; some components may restart. {"sessionId", "components":[{"name","desc"}]}

Apply only after Step 2 reports offset == size. The session id doubles as the template id in the Step 3 path.


Deprecated: old /dm/template flow

Still present in the collection under Templates -> Old method of template apply. Not recommended for new work; documented here for older devices.

Download (old): POST {{edgeUrl}}/dm/template -- body is JSON with bare device-ID strings and per-area boolean flags ("country": true). Discover eligible items with GET {{edgeUrl}}/dm/template.

Apply (old, 3 steps):

Step Name in Collection Method Endpoint Body / Notes Output
0 Step 0: Apply Template DELETE {{edgeUrl}}/dm/template/v2 No body. Clears any stale upload session. 200 OK
1 Step 1: Apply Template POST {{edgeUrl}}/dm/template/v2 {"size": <file_bytes>} {"id": "<session_id>"}
2 Step 2: Apply Template PUT {{edgeUrl}}/dm/template/v2/{id_from_step1}/resume Binary file bytes in body 200 OK, template applied

Key differences from the current flow: the old apply combines upload + apply into one Step 2 call and needs an explicit Step 0 "clear session"; the new flow splits upload (PATCH) from apply (PUT) and drops the clear step.


View this page as Markdown