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

January 12, 2015 1k views

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?

1 comment
  • Additional note, the "images" query doesn't have a qualifier like 'types=snapshot' to distinguish it from something like 'backup', 'distro', or 'all'.

1 Answer

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": [
      "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' \ \
| 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:

  • @asb - Yes, a public filter would be good since the images request takes longer than most others.

    I'll put my follow-up questions at github. Thanks for the answer and that link.

Have another answer? Share your knowledge.