Aller au contenu principal

Restores

9 routes de l'API publique. Textes de la source : openapi-csp.json du dépôt platform.

Create mssql restore​

POST /endpoints/{id}/mssql/restores

Accès : Clé API du MSP, portée operate.

Paramètres

NomEmplacementTypeObligatoireDescription
idcheminstring (uuid)oui

Corps de la requête (application/json)

NomTypeObligatoireDescription
snapshot_idstringoui
target_endpoint_idstring (uuid)nonAgent that restores, same client. Absent: the source agent.
instancestringouiInstance of the target agent.
itemsarray of objectouiÉléments : 1 à 100.
items[].database_namestringouiDatabase of the snapshot; not a system database. Longueur : 1 à 128.
items[].targetobjectoui
items[].filesanynonRefused: the agent picks the files.
safety_fullbooleannonA full of each replace target before it is overwritten. Off by default, never forced. Défaut : false.
checkdbbooleannonDBCC CHECKDB after each restore. Défaut : false.
confirmation_tokenstringnonconfirmation_token of POST .../mssql/restores/preview for this exact request: required with an OAuth token (MCP), single use. Longueur : 1 à 128.
filesanynonRefused: the agent picks the files.

Réponses

CodeDescription
202Success
defaultError (400, 401, 403, 404, 409, 415, 422, 429, 500, 502, 503 or 504)

Réponse 202 (application/json)

NomTypeObligatoireDescription
restore_session_idstring (uuid)oui

Preview mssql restore​

POST /endpoints/{id}/mssql/restores/preview

Accès : Clé API du MSP, portée operate.

Paramètres

NomEmplacementTypeObligatoireDescription
idcheminstring (uuid)oui

Corps de la requête (application/json)

NomTypeObligatoireDescription
snapshot_idstringoui
target_endpoint_idstring (uuid)nonAgent that restores, same client. Absent: the source agent.
instancestringouiInstance of the target agent.
itemsarray of objectouiÉléments : 1 à 100.
items[].database_namestringouiDatabase of the snapshot; not a system database. Longueur : 1 à 128.
items[].target_databasestringnonNew database name; absent: the api proposes one. Longueur : 1 à 100.
checkdbbooleannonDBCC CHECKDB after each restore. Défaut : false.

Réponses

CodeDescription
200Success
defaultError (400, 401, 403, 404, 409, 415, 422, 429, 500, 502, 503 or 504)

Réponse 200 (application/json)

NomTypeObligatoireDescription
requestobjectouiThe request the token is bound to.
request.snapshot_idstringoui
request.target_endpoint_idstring (uuid)oui
request.instancestringouiMSSQLSERVER for the default instance, else the instance name.
request.itemsarray of objectouiÉléments : 1 à 100.
request.checkdbbooleanoui
databasesarray of objectouiÉléments : 1 à 100.
databases[].database_namestringouiDatabase name as SQL Server gives it, 1 to 128 UTF-16 code units. Longueur : 1 à 128.
databases[].target_databasestringouiNew database name: 1 to 100 UTF-16 code units, Unicode letters and digits, _, -, ., space; not a Windows reserved name or a system database. Longueur : 1 à 100.
databases[].target_proposedbooleanouiThe api chose the name.
databases[].size_bytesinteger | nullouiSize of the stored backup.
databases[].data_size_bytesinteger | nullouiSpace the database takes on the target.
databases[].recovery_model"FULL" | "BULK_LOGGED" | "SIMPLE" | nulloui
databases[].server_versionstringouiSQL Server version of the backup.
snapshot_created_atstring (date-time)oui
source_endpoint_idstring (uuid)oui
target_server_versionstringouiChecked: not older than the version of each backup.
data_size_bytesintegerouiSum of data_size_bytes Valeur minimum : 0.
data_free_bytesinteger | nullouiFree space of the data volume of the target instance at its last inventory; null if unknown.
confirmation_tokenstringouiLongueur : 1 à 128.
confirmation_expires_atstring (date-time)oui

List restore sessions​

GET /endpoints/{id}/restore-sessions

Accès : Clé API du MSP, portée read.

Paramètres

NomEmplacementTypeObligatoireDescription
idcheminstring (uuid)oui
limitrequêteintegernonDéfaut : 50. Valeur : 1 à 100.
cursorrequêtestringnonLongueur minimum : 1.

Réponses

CodeDescription
200Success
defaultError (400, 401, 403, 404, 409, 415, 422, 429, 500, 502, 503 or 504)

Réponse 200 (application/json)

NomTypeObligatoireDescription
itemsarray of objectoui
items[].idstring (uuid)oui
items[].endpoint_idstring (uuid)oui
items[].repo_idstring (uuid)oui
items[].opened_atstring (date-time)oui
items[].expires_atstring (date-time)oui
items[].closed_atstring (date-time) | nulloui
items[].origin"agent" | "portal"non
items[].status"pending" | "running" | "succeeded" | "partial" | "failed" | "cancelled" | nullnonNull for a CLI session: it is open, closed or expired.
items[].cause"no_ack" | "stalled" | "agent_restarted" | "cancelled_by_user" | "unknown_order_type" | "restore_busy" | "restore_disabled" | "target_forbidden" | "target_not_directory" | "invalid_order" | "agent_error" | "restore_failed" | nullnon
items[].snapshot_idstring | nullnon
items[].source_hostnamestringnonName of the source agent (endpoint_id)
items[].target_endpoint_idstring (uuid) | nullnon
items[].target_hostnamestring | nullnon
items[].target_client_idstring (uuid) | nullnonClient of the target agent: another client than the source's is a Q11 restore.
items[].requested_bystring (uuid) | nullnon
items[].requested_by_namestring | nullnonNull if the user was deleted.
items[].requestobject | nullnon
items[].statsobject | nullnon
items[].errorsarray of object | nullnonAt most 100 file errors. Null for msp_readonly (that role sees the counters, not the paths) and for a call with an OAuth access token (MCP)
items[].error_codesarray of object | nullnonCount per code of the stored file errors (errors, at most 100), most frequent first, without paths: for every role and for an OAuth access token (MCP). Null without stored errors.
items[].progressobject | nullnonOnly while running
items[].vmobject | nullnonRestore of a Hyper-V VM; then request and stats are null. Null otherwise.
next_cursorstring | nulloui

Create restore​

POST /endpoints/{id}/restores

Accès : Clé API du MSP, portée operate.

Paramètres

NomEmplacementTypeObligatoireDescription
idcheminstring (uuid)oui

Corps de la requête (application/json)

NomTypeObligatoireDescription
snapshot_idstringouiSnapshot of the source agent's repo, known to the backend and not forgotten.
pathsarray of stringouiFiles or directories of the snapshot, 1 to 1000. ["/"] = the whole snapshot. A path under another one of the list is dropped by the api. Éléments : 1 à 1000.
target_endpoint_idstring (uuid)nonAgent that restores. Absent: the source agent.
targetobjectoui
overwrite"never" | "if_changed"nonDéfaut : "never".
confirm_cross_clientbooleannonRequired and true when the target agent belongs to another client of the MSP (Q11)
bytes_estimatedintegernonSize of the selection, if the portal computed it. Information only, not checked. Valeur minimum : 0.

Réponses

CodeDescription
202Success
defaultError (400, 401, 403, 404, 409, 415, 422, 429, 500, 502, 503 or 504)

Réponse 202 (application/json)

NomTypeObligatoireDescription
restore_session_idstring (uuid)oui

List vm restore targets​

GET /endpoints/{id}/vm-restore-targets

Accès : Clé API du MSP, portée read.

Paramètres

NomEmplacementTypeObligatoireDescription
idcheminstring (uuid)oui
snapshot_idrequêtestringouiSnapshot of a VM or container of the source agent: its configuration version (Hyper-V) or machine version (Proxmox VM) decides config_version_unsupported or machine_version_unsupported

Réponses

CodeDescription
200Success
defaultError (400, 401, 403, 404, 409, 415, 422, 429, 500, 502, 503 or 504)

Réponse 200 (application/json)

NomTypeObligatoireDescription
hypervisor"hyperv" | "proxmox"nonHypervisor of the snapshot. Absent: older backend, Hyper-V.
config_versionstring | nullouiHyper-V: configuration version of the VM in the last inventory of the source; null if unknown or Proxmox (the agent checks it)
machinestring | nullnonProxmox VM: machine of the VM in the last inventory of the source (S2 § 6.7); null if unknown, not set or a container (the agent checks it)
itemsarray of objectouiÉléments maximum : 500.
items[].endpoint_idstring (uuid)oui
items[].namestringouiName of the endpoint.
items[].hostnamestring | nulloui
items[].sourcebooleanouiThe source host or node of the snapshot.
items[].onlinebooleanoui
items[].hostobject | nullouiHyper-V host data of the last inventory: switches, default folder, free space of the volumes. Null for a Proxmox node.
items[].proxmox_hostobject | nullnonProxmox node data of the last inventory: versions, storages, bridges. Null for a Hyper-V host or before the first inventory. Absent: older backend.
items[].unavailable"target_not_hyperv" | "config_version_unsupported" | "agent_too_old" | "target_agent_deleting" | "agent_offline" | "target_not_proxmox" | "pve_unsupported_version" | "machine_version_unsupported" | nullouiNull: the host can be the target. Else the 409 that createVmRestore would answer.
items[].tpm"preserved" | "empty" | nullouiThe TPM of the VM after the restore on this host. Null: the VM has no TPM.
items[].tpm_reason"guardian_present_on_target" | "guardian_in_backup" | "guardian_not_in_backup" | nullouiNull if and only if tpm is null.
truncatedbooleanouiMore than 500 agents: the first ones by name.

Preview vm restore​

POST /endpoints/{id}/vm-restores/preview

Accès : Clé API du MSP, portée operate.

Paramètres

NomEmplacementTypeObligatoireDescription
idcheminstring (uuid)oui

Corps de la requête (application/json)

NomTypeObligatoireDescription
snapshot_idstringouiSnapshot of a VM or a container, known to the backend and not forgotten.
target_endpoint_idstring (uuid)nonAgent of the same hypervisor that restores. Absent: the source agent.
target_pathstring | nullnonHyper-V only (422 otherwise)
namestringnonAbsent: <name>-restore-<YYYYMMDD> Longueur : 1 à 100.
keep_macsbooleannonDéfaut : false.
switchstring | nullnonAbsent: the switch of each NIC of the source if the target host has it, else not connected (the agent reads the manifest)
startbooleannonDéfaut : false.
target_storagestringnonProxmox only (422 otherwise). An active storage of the target node that accepts images (VM) or rootdir (container), else 409 target_storage_invalid before any write when the inventory of the node is known. Absent: the source storage of each disk, with the same rule.
target_format"raw" | "qcow2"nonProxmox VM only. Absent: qcow2 on a dir storage, raw elsewhere.
bridgestring | nullnonProxmox only. Absent: the bridge of each source NIC if the target node has it, else link_down=1
confirm_tpm_resetbooleannonProxmox VM with a TPM: required true, else 409 tpm_confirmation_required (S2 § 6.6). The user has the BitLocker recovery key.

Réponses

CodeDescription
200Success
defaultError (400, 401, 403, 404, 409, 415, 422, 429, 500, 502, 503 or 504)

Réponse 200 (application/json)

NomTypeObligatoireDescription
snapshot_idstringoui
vm_keystringouihyperv:<endpoint id>:<VM GUID> or proxmox:<endpoint id>:<uuid>, lower case.
vm_namestringouiName of the VM in the last inventory of the source host, else the GUID.
captured_atstring (date-time) | nullouiPoint in time of the snapshot; null if the backend has no result for it.
consistency"app_consistent" | "fs_frozen" | "crash" | "stopped" | nulloui
source_endpoint_idstring (uuid)oui
target_endpoint_idstring (uuid)oui
target_namestringouiName of the target endpoint.
same_hostbooleanoui
namestringouiName of the new VM. Longueur : 1 à 100.
target_pathstring | nullouiNull: the default folder of the disks of the target host.
switchstring | nullnonNull: NICs not connected. Absent: the switch of each source NIC if the target host has it, else not connected.
keep_macsbooleanoui
startbooleanoui
hypervisor"hyperv" | "proxmox"nonAbsent: Hyper-V (answers before Proxmox)
kind"vm" | "ct"nonProxmox: vm or ct (container). Absent: vm
target_storagestring | nullnonProxmox: the storage of the new disks; null, the source storage of each disk.
target_format"raw" | "qcow2" | nullnonProxmox VM: null, the default of the storage.
bridgestring | nullnonProxmox: null, NICs with link_down=1. Absent: the bridge of each source NIC if the target node has it.
bytesinteger | nullouiBytes of the disk files of the snapshot (read at backup); null if unknown.
free_bytesinteger | nullouiFree bytes of the target volume (Hyper-V) or of the target storage (Proxmox, when all the disks go to one storage) in the last inventory of the target; null if unknown.
space_okboolean | nullouifree_bytes >= bytes x 1.1; null if unknown (the agent checks it: restore_no_space)
tpm"preserved" | "empty" | nullouiThe TPM of the VM after the restore on this host. Null: the VM has no TPM.
tpm_reason"guardian_present_on_target" | "guardian_in_backup" | "guardian_not_in_backup" | nullouiNull if and only if tpm is null.
warningsarray of "tpm_other_host" | "keep_macs_source_running" | "space_unknown" | "ct_static_ip_source_running"ouitpm_other_host: tpm is empty (another host without the guardian, none in the snapshot), BitLocker in the guest asks for its recovery key. keep_macs_source_running: the MACs are kept and the source VM runs: address conflict on the same network. ct_static_ip_source_running: the container has a fixed IP address and the source runs: the new container gets the same address, address conflict on the same bridge. Do not start it after the restore: change its address first.
confirmation_tokenstringnonThrough MCP only.
confirmation_expires_atstring (date-time)non

Create vm restore​

POST /endpoints/{id}/vm-restores

Accès : Clé API du MSP, portée operate.

Paramètres

NomEmplacementTypeObligatoireDescription
idcheminstring (uuid)oui

Corps de la requête (application/json)

NomTypeObligatoireDescription
snapshot_idstringouiSnapshot of a VM or a container, known to the backend and not forgotten.
target_endpoint_idstring (uuid)nonAgent of the same hypervisor that restores. Absent: the source agent.
target_pathstring | nullnonHyper-V only (422 otherwise)
namestringnonAbsent: <name>-restore-<YYYYMMDD> Longueur : 1 à 100.
keep_macsbooleannonDéfaut : false.
switchstring | nullnonAbsent: the switch of each NIC of the source if the target host has it, else not connected (the agent reads the manifest)
startbooleannonDéfaut : false.
confirmation_tokenstringnonThrough MCP only, and then required: the confirmation_token of previewVmRestore for this exact request Longueur : 1 à 128.
target_storagestringnonProxmox only (422 otherwise). An active storage of the target node that accepts images (VM) or rootdir (container), else 409 target_storage_invalid before any write when the inventory of the node is known. Absent: the source storage of each disk, with the same rule.
target_format"raw" | "qcow2"nonProxmox VM only. Absent: qcow2 on a dir storage, raw elsewhere.
bridgestring | nullnonProxmox only. Absent: the bridge of each source NIC if the target node has it, else link_down=1
confirm_tpm_resetbooleannonProxmox VM with a TPM: required true, else 409 tpm_confirmation_required (S2 § 6.6). The user has the BitLocker recovery key.

Réponses

CodeDescription
202Success
defaultError (400, 401, 403, 404, 409, 415, 422, 429, 500, 502, 503 or 504)

Réponse 202 (application/json)

NomTypeObligatoireDescription
restore_session_idstring (uuid)oui

Get restore session​

GET /restore-sessions/{id}

Accès : Clé API du MSP, portée read.

Paramètres

NomEmplacementTypeObligatoireDescription
idcheminstring (uuid)oui

Réponses

CodeDescription
200Success
defaultError (400, 401, 403, 404, 409, 415, 422, 429, 500, 502, 503 or 504)

Réponse 200 (application/json)

NomTypeObligatoireDescription
idstring (uuid)oui
endpoint_idstring (uuid)oui
repo_idstring (uuid)oui
opened_atstring (date-time)oui
expires_atstring (date-time)oui
closed_atstring (date-time) | nulloui
origin"agent" | "portal"non
status"pending" | "running" | "succeeded" | "partial" | "failed" | "cancelled" | nullnonNull for a CLI session: it is open, closed or expired.
cause"no_ack" | "stalled" | "agent_restarted" | "cancelled_by_user" | "unknown_order_type" | "restore_busy" | "restore_disabled" | "target_forbidden" | "target_not_directory" | "invalid_order" | "agent_error" | "restore_failed" | nullnon
snapshot_idstring | nullnon
source_hostnamestringnonName of the source agent (endpoint_id)
target_endpoint_idstring (uuid) | nullnon
target_hostnamestring | nullnon
target_client_idstring (uuid) | nullnonClient of the target agent: another client than the source's is a Q11 restore.
requested_bystring (uuid) | nullnon
requested_by_namestring | nullnonNull if the user was deleted.
requestobject | nullnon
statsobject | nullnon
errorsarray of object | nullnonAt most 100 file errors. Null for msp_readonly (that role sees the counters, not the paths) and for a call with an OAuth access token (MCP)
error_codesarray of object | nullnonCount per code of the stored file errors (errors, at most 100), most frequent first, without paths: for every role and for an OAuth access token (MCP). Null without stored errors.
progressobject | nullnonOnly while running
vmobject | nullnonRestore of a Hyper-V VM; then request and stats are null. Null otherwise.

Cancel restore session​

POST /restore-sessions/{id}/cancel

Accès : Clé API du MSP, portée operate.

Paramètres

NomEmplacementTypeObligatoireDescription
idcheminstring (uuid)oui

Réponses

CodeDescription
202Success
defaultError (400, 401, 403, 404, 409, 415, 422, 429, 500, 502, 503 or 504)

Réponse 202 (application/json)

NomTypeObligatoireDescription
idstring (uuid)oui
endpoint_idstring (uuid)oui
repo_idstring (uuid)oui
opened_atstring (date-time)oui
expires_atstring (date-time)oui
closed_atstring (date-time) | nulloui
origin"agent" | "portal"non
status"pending" | "running" | "succeeded" | "partial" | "failed" | "cancelled" | nullnonNull for a CLI session: it is open, closed or expired.
cause"no_ack" | "stalled" | "agent_restarted" | "cancelled_by_user" | "unknown_order_type" | "restore_busy" | "restore_disabled" | "target_forbidden" | "target_not_directory" | "invalid_order" | "agent_error" | "restore_failed" | nullnon
snapshot_idstring | nullnon
source_hostnamestringnonName of the source agent (endpoint_id)
target_endpoint_idstring (uuid) | nullnon
target_hostnamestring | nullnon
target_client_idstring (uuid) | nullnonClient of the target agent: another client than the source's is a Q11 restore.
requested_bystring (uuid) | nullnon
requested_by_namestring | nullnonNull if the user was deleted.
requestobject | nullnon
statsobject | nullnon
errorsarray of object | nullnonAt most 100 file errors. Null for msp_readonly (that role sees the counters, not the paths) and for a call with an OAuth access token (MCP)
error_codesarray of object | nullnonCount per code of the stored file errors (errors, at most 100), most frequent first, without paths: for every role and for an OAuth access token (MCP). Null without stored errors.
progressobject | nullnonOnly while running
vmobject | nullnonRestore of a Hyper-V VM; then request and stats are null. Null otherwise.