pydo.droplets.list_snapshots()

Description

To retrieve the snapshots that have been created from a Droplet, send a GET request to /v2/droplets/$DROPLET_ID/snapshots.

You will get back a JSON object that has a snapshots key. This will be set to an array of snapshot objects, each of which contain the standard Droplet snapshot attributes.

Parameters

Name Type Required Description Default Value
droplet_id integer True A unique identifier for a Droplet instance.
per_page integer False Number of items returned per page 20
page integer False Which ‘page’ of paginated results to return. 1

Request Sample

import os
from pydo import Client

client = Client(token=os.environ.get("DIGITALOCEAN_TOKEN"))

resp = client.droplets.list_snapshots(droplet_id=3929391)

Responses

See the API spec for this endpoint to view additional detail on responses, headers, parameters, and more.

A JSON object with an snapshots key.

Click to expand an example response.
{
  "snapshots": [
    {
      "id": 6372321,
      "name": "web-01-1595954862243",
      "created_at": "2020-07-28T16:47:44Z",
      "regions": [
        "nyc3",
        "sfo3"
      ],
      "min_disk_size": 25,
      "size_gigabytes": 2.34,
      "type": "snapshot"
    }
  ],
  "links": {},
  "meta": {
    "total": 1
  }
}

Unauthorized

Click to expand an example response.
{
  "id": "unauthorized",
  "message": "Unable to authenticate you."
}

The resource was not found.

Click to expand an example response.
{
  "id": "not_found",
  "message": "The resource you requested could not be found."
}

API Rate limit exceeded

Click to expand an example response.
{
  "id": "too_many_requests",
  "message": "API Rate limit exceeded."
}

Server error.

Click to expand an example response.
{
  "id": "server_error",
  "message": "Unexpected server-side error"
}

Unexpected error

Click to expand an example response.
{
  "id": "example_error",
  "message": "some error message"
}