location
key instead of server
. This can be either the ID or the name of the Location this Volume will be created in. Note that a Volume can be attached to a Server only in the same Location as the Volume itself.next_actions
key in the response is an array which contains a single attach_volume
action.Code | Description |
---|---|
no_space_left_in_location | There is no volume space left in the given location |
curl --location --request POST 'https://api.hetzner.cloud/v1/volumes' \
--header 'Content-Type: application/json' \
--data-raw '{
"automount": false,
"format": "xfs",
"labels": {
"labelkey": "value"
},
"location": "nbg1",
"name": "test-database",
"size": 42
}'
{
"action": {
"command": "create_volume",
"error": {
"code": "action_failed",
"message": "Action failed"
},
"finished": null,
"id": 13,
"progress": 0,
"resources": [
{
"id": 42,
"type": "server"
},
{
"id": 554,
"type": "volume"
}
],
"started": "2016-01-30T23:50:00.000Z",
"status": "running"
},
"next_actions": [
{
"command": "attach_volume",
"error": {
"code": "action_failed",
"message": "Action failed"
},
"finished": null,
"id": 13,
"progress": 0,
"resources": [
{
"id": 42,
"type": "server"
},
{
"id": 554,
"type": "volume"
}
],
"started": "2016-01-30T23:50:00.000Z",
"status": "running"
}
],
"volume": {
"created": "2016-01-30T23:50:11.000Z",
"format": "xfs",
"id": 4711,
"labels": {
"env": "dev"
},
"linux_device": "/dev/disk/by-id/scsi-0HC_Volume_4711",
"location": {
"city": "Falkenstein",
"country": "DE",
"description": "Falkenstein DC Park 1",
"id": 1,
"latitude": 50.47612,
"longitude": 12.370071,
"name": "fsn1",
"network_zone": "eu-central"
},
"name": "database-storage",
"protection": {
"delete": false
},
"server": 12,
"size": 42,
"status": "available"
}
}