Getting StartedInstancesImagesSnapshotsVolumesCreate a VolumeList VolumesGet VolumeDelete a VolumeExamples (cURL)SSH KeysSecurity GroupsExamples

Volumes

Create a Volume

To create a new volume, send a request to:

POST /compute/v1/volumes (HTTP 201 - Created)

The attribute values that must be set to successfully create a volume are:

Body parameters

  • name String Required - The human-readable name set for the volume.
  • description String Required - The human-readable description set for the volume.
  • size BigInt Required - The storage size of this volume given in GiB (Min: 1GiB).
{
"name": "<volume name>",
"description": "<volume description>",
"size": 50
}

Body response

The volume will be created using the provided information. The response body will contain a JSON object with standard attributes for your new volume:

  • id String - A unique identifier for each volume. This is automatically generated.
  • name String - The human-readable name set for the volume.
  • description String - The human-readable description set for the volume.
  • size BigInt (String) - The storage size of this volume given in GiB.
  • instances Array - The attached instances.
  • status String - The volume status. Possible values are available, deleted, and error.
  • created_at String - A time value given in ISO8601 combined date and time format that represents when the volume was created.
{
"volume": {
"id": "0580fb4c-de74-4b83-8bdb-1fd87d89f827",
"name": "<volume name>",
"description": "<volume description>",
"size": 50,
"instances": [],
"status": "available",
"created_at": "2020-07-28T07:53:11.177Z"
}
}

List Volumes

Lists all volumes of an account.

GET /compute/v1/volumes (HTTP 200 - OK)

Query parameters

  • per_page Integer Optional - A positive integer lower than or equal to 100 to select the number of items to return (default: 50).
  • page Integer Optional - A positive integer to choose the page to return.

Response body

The response will be a JSON object with pagination details and a key called volumes. This will be set to an array of volume objects, each of which will contain the volume object:

  • id String - A unique identifier for each volume. This is automatically generated.
  • name String - The human-readable name set for the volume.
  • description String - The human-readable description set for the volume.
  • size BigInt (String) - The storage size of this volume given in GiB.
  • instances Array - The attached instances.
  • status String - The volume status. Possible values are available, deleted, and error.
  • created_at String - A time value given in ISO8601 combined date and time format that represents when the volume was created.
{
"volumes": [
{
"id": "0580fb4c-de74-4b83-8bdb-1fd87d89f827",
"name": "<volume name>",
"description": "<volume description>",
"size": 50,
"instances": [
{
"id": "4c177746-3565-4fa3-872c-d8c6863c285b",
"name": "<instance-name>"
}
],
"status": "available",
"created_at": "2020-07-28T07:53:11.177Z"
}
],
"total_count": 1,
"page": 1,
"per_page": 50
}

Get Volume

Get details of one volume with a given ID.

GET /compute/v1/volumes/<volume_id> (HTTP 200 - OK)

Path parameters:

  • volume_id String - volume id

Response body

The response will be a JSON object that contains the volume attributes:

  • id String - A unique identifier for each volume. This is automatically generated.
  • name String - The human-readable name set for the volume.
  • description String - The human-readable description set for the volume.
  • size BigInt (String) - The storage size of this volume given in GiB.
  • instances Array - The attached instances.
  • status String - The volume status. Possible values are available, deleted, and error.
  • created_at String - A time value given in ISO8601 combined date and time format that represents when the volume was created.
{
"volume": {
"id": "0580fb4c-de74-4b83-8bdb-1fd87d89f827",
"name": "<volume name>",
"description": "<volume description>",
"size": 1,
"instances": [
{
"id": "4c177746-3565-4fa3-872c-d8c6863c285b",
"name": "<instance-name>"
}
],
"status": "available",
"created_at": "2020-07-28T07:53:11.177Z"
}
}

Delete a Volume

Delete a volume with the given ID

DELETE /compute/v1/volumes/<volume_id> (HTTP 204 - No content)

Path parameters:

  • volume_id String - volume id

Examples (cURL)

# Create a new volume
curl -H "X-Auth-Token: $TOKEN" \
-X POST "https://api.genesiscloud.com/compute/v1/volumes" \
-H "Content-Type: application/json" \
--data-binary @- << EOF
{
"name": "name",
"description": "description",
"size": 1
}
EOF
# List all volumes
curl -H "X-Auth-Token: $TOKEN" \
"https://api.genesiscloud.com/compute/v1/volumes"
# Get a volume by id
curl -H "X-Auth-Token: $TOKEN" \
"https://api.genesiscloud.com/compute/v1/volumes/<volume_id>"
# Delete a volume by id
curl -H "X-Auth-Token: $TOKEN" \
-X DELETE "https://api.genesiscloud.com/compute/v1/volumes/<volume_id>"