Question

DO APIv2 feedback - getting available snapshot info associated with deleted droplets

  • Posted on January 12, 2015
  • gndoAsked by gndo

I noticed that the DO API only allows query of snapshots so long as you have a droplet ID. However, if you delete the droplet, the droplet ID will no longer be available in any of the API queries even though the associated snapshot still exists.

The workaround is to have a local cache of any droplet IDs that have been created and query each one for any snapshots. However, it seems like it makes more sense to query available snapshots based on the account rather than the droplet id. Did I miss something in the API to do this?

Show comments

Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

When querying /v2/images , you can look at the public attribute:

  "images": [
    {
      "id": 7555620,
      "name": "Nifty New Snapshot",
      "distribution": "Ubuntu",
      "slug": null,
      "public": false,
      "regions": [
        "nyc2",
        "nyc2"
      ],
      "created_at": "2014-11-04T22:23:02Z",
      "min_disk_size": 20
    }

Your snapshots, as opposed to base distros and One-Click apps, will be "public": false For example using something like the jq utility, you can filter out public images:

curl -X GET -H 'Content-Type: application/json' \
-H 'Authorization: Bearer $TOKEN' \
https://api.digitalocean.com/v2/images?per_page=200 \
| jq '.images[] | select(.public == 'false')'

Though it might make sense to add additional filters directly into the API as we already do with ‘distro’ and ‘application’ We collect API feedback in GitHub issues: