To list all of the block storage volumes available on your account, send a GET request to /v2/volumes
.
The region
may be provided as query parameter in order to restrict results to volumes available in a specific region. For example: /v2/volumes?region=nyc1
It is also possible to list volumes on your account that match a specified name. To do so, send a GET request with the volume’s name as a query parameter to /v2/volumes?name=$VOLUME_NAME
.
Note: You can only create one volume per region with the same name.
It is also possible to retrieve information about a block storage volume by name. To do so, send a GET request with the volume’s name and the region slug for the region it is located in as query parameters to /v2/volumes?name=$VOLUME_NAME®ion=nyc1
.
Name | Type | Required | Description | Default Value |
---|---|---|---|---|
name |
string | False | The block storage volume’s name. | |
region |
string | False | The slug identifier for the region where the resource is available. | |
per_page |
integer | False | Number of items returned per page | 20 |
page |
integer | False | Which ‘page’ of paginated results to return. | 1 |
import os
from pydo import Client
client = Client(token=os.environ.get("DIGITALOCEAN_TOKEN"))
resp = client.volumes.list(region="nyc3")
See the API spec for this endpoint to view additional detail on responses, headers, parameters, and more.