Recover buffered device data
POST/api/v1/devices/{deviceId}/commands:resync
Requests manual recovery of cloud data lost while the device was online and still holds it in its local buffer. Issues the edge command report.historical for one device and one time range; the device re-uploads the whole range and the cloud overwrites it (full replace, no gap detection). startedAt must be strictly before endedAt and no older than the 7-day recovery horizon (else 422). Runs asynchronously. 202 returns a command-result object; then GET commands/results and match the returned reqSeqId in the items to follow pending -> ack -> progress -> result.
Request
Responses
- 202
- 400
- 401
- 403
- 404
- 409
- 422
- 503
Accepted. Returns the initial command-result envelope (reqSeqId, phase, status, message) with resultData echoing the accepted range, effective horizon and timeoutSeconds; track it via GET commands/results until it reaches result, or times out (data.status = 1, error timedOut).
The request body is missing or malformed, for example startedAt or endedAt is not a valid ISO-8601 timestamp (ValidationError). Also returned when the caller's resource_access claim could not be parsed.
Authentication is required, or the token is invalid.
The caller is not an admin of the organization owning this device (Command.NotAuthorized).
Device not found or outside the organizations the caller can access (Device.NotFound), or the device publishes no DTDL model at all (Command.NotFound).
The device is not connected, so the command is rejected rather than queued (Command.OfflineDevice)
Either the target device's agent provides no capability model, so this operation cannot be served (Device.CapabilityNotSupported), or the request is rejected (Command.InvalidParameters). Command.InvalidParameters is returned when startedAt or endedAt is missing or null (including an empty JSON object body), startedAt is not strictly before endedAt, startedAt or endedAt is in the future, or timeoutSeconds is outside 1800..86400. Command.HorizonExceeded is returned when startedAt is older than the 7-day recovery horizon; its extension carries requestedRange, effectiveHorizon and suggestedRange. The request body is checked after the device. If the device is not found, has no capability model, the caller's role is too low, or the device is offline, the API returns 404, 422 (Device.CapabilityNotSupported), 403 or 409 first. The example below shows Device.CapabilityNotSupported.
The device's command catalog could not be read. Transient. The device may well support this command; retry.