To list all of the snapshots available on your account, send a GET request to
/v2/snapshots
.
The response will be a JSON object with a key called snapshots
. This will be
set to an array of snapshot
objects, each of which will contain the standard
snapshot attributes.
It’s possible to request filtered results by including certain query parameters.
To retrieve only snapshots based on Droplets, include the resource_type
query parameter set to droplet
. For example, /v2/snapshots?resource_type=droplet
.
To retrieve only snapshots based on volumes, include the resource_type
query parameter set to volume
. For example, /v2/snapshots?resource_type=volume
.
Name | Type | Required | Description | Default Value |
---|---|---|---|---|
per_page |
integer | False | Number of items returned per page | 20 |
page |
integer | False | Which ‘page’ of paginated results to return. | 1 |
resource_type |
string | False | Used to filter snapshots by a resource type. |
import os
from pydo import Client
client = Client(token=os.environ.get("DIGITALOCEAN_TOKEN"))
resp = client.snapshots.list()
See the API spec for this endpoint to view additional detail on responses, headers, parameters, and more.