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?
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!
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:
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.