Roll back a group of devices to their previous application version
const url = 'http://localhost:3000/api/v1/devices/rollback-version';const options = { method: 'POST', headers: {'X-API-Key': '<X-API-Key>', 'Content-Type': 'application/json'}, body: '{"deviceSelector":{"matchLabels":{"site":"plant-a"},"matchExpressions":[{"key":"line","operator":"In","values":["line-3"]}]},"reason":"example","applicationPackageId":"2489E9AD-2EE2-8E00-8EC9-32D5F69181C0"}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url http://localhost:3000/api/v1/devices/rollback-version \ --header 'Content-Type: application/json' \ --header 'X-API-Key: <X-API-Key>' \ --data '{ "deviceSelector": { "matchLabels": { "site": "plant-a" }, "matchExpressions": [ { "key": "line", "operator": "In", "values": [ "line-3" ] } ] }, "reason": "example", "applicationPackageId": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0" }'Re-deploys, in place, the revision (version and parameters) each matching device ran before its current one. Each device follows the rules of the device route: a device of a shared deployment is split off first, and its Margo deployment id is kept. Devices with no earlier revision, or with history written before revisions existed, are reported as skipped rather than failing the batch. This does not abort an in-flight rollout — see the deployment rollback route.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Header Parameters
Section titled “Header Parameters”UUID of the organization (tenant) the request acts in. It selects the tenant and grants nothing: the server checks membership or an open tenant switch. Not needed for global operations. A malformed value returns 400. API keys are fixed to their own organization; another organization returns 403. The x-organization-source header grants nothing.
Request Bodyrequired
Section titled “Request Bodyrequired”object
Label selector choosing which devices to roll back
object
Exact label equality match; all entries must match (AND).
object
Example
{ "site": "plant-a"}object
Label key to match on
Example
lineExample
InExample
[ "line-3"]Operator-supplied reason, recorded on the audit entry
Which application package to roll back on every matching device.
Responses
Section titled “Responses”Rollback evaluated for every matching device
DeviceSelector missing or malformed
Forbidden — caller lacks required permission
No devices matched the selector