Change the disk
POST/api/v1/vms/{vm_uuid}/disk/change-class
Moves the root disk between shared and dedicated while the server runs. The data stays in place and the new price applies from the next hour.
Parameters
| Name | In | Description |
|---|---|---|
| vm_uuid | path, stringrequired | Server id, from Create a VM or List VMs |
Request body
| Field | Type | Description |
|---|---|---|
| storage_class_id | integerrequired | The new disk id, from List disks |
Example request
curl -X POST "https://platform.serverscamp.com/api/v1/vms/$VM_UUID/disk/change-class" \
-H "Authorization: Bearer $API_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"storage_class_id": 19
}'import os, requests
token = os.environ["API_TOKEN"]
vm_uuid = "6f1c2a9e-4b3d-4e8a-9c71-2d5e8f0a1b34"
r = requests.post(
f"https://platform.serverscamp.com/api/v1/vms/{vm_uuid}/disk/change-class",
headers={"Authorization": f"Bearer {token}"},
json={
"storage_class_id": 19
},
)
r.raise_for_status()
print(r.json())const vmUuid = '6f1c2a9e-4b3d-4e8a-9c71-2d5e8f0a1b34';
const r = await fetch(`https://platform.serverscamp.com/api/v1/vms/${vmUuid}/disk/change-class`, {
method: 'POST',
headers: { Authorization: `Bearer ${process.env.API_TOKEN}`, 'Content-Type': 'application/json' },
body: JSON.stringify({
"storage_class_id": 19
}),
});
console.log(r.status, await r.json());Answer
Status 200 with this body.
| Field | Type | Description |
|---|---|---|
| vm_uuid | stringrequired | |
| status | stringrequired | queued: the change runs in the background while the server runs |
| disk_gb | integerrequired | Root disk size after the change, GB |
| storage_class_id | integerrequired | Disk id after the change |
{
"vm_uuid": "6f1c2a9e-4b3d-4e8a-9c71-2d5e8f0a1b34",
"status": "queued",
"disk_gb": 50,
"storage_class_id": 19
}Errors
| Status | When |
|---|---|
400 | A disk the root disk cannot move to, or the one it has |
401 | No token, or a token that is not valid |
409 | The server is busy with another operation |
422 | The body or a parameter is not what the operation takes |
Every operation can also answer 401 without a valid token. All errors