Question

Snapshots API should list only snapshots?

Posted June 28, 2017 1.5k views
Debian API

I got only 5 snapshots in dashboard which is correct but API…

curl -X GET "https://api.digitalocean.com/v2/snapshots?page=1&per_page=100" \
    -H "Authorization: Bearer $TOKEN" \
    -H "Content-Type: application/json"

…list me 67 snapshots for some reason. I think API list all image instead of 5 snapshots.

Any hint? Thanks.

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.

1 answer

The /v2/snapshots endpoint can be used to list and act on snapshots for both Droplets and block storage volumes. To limit the output to Droplets snapshots only, add this query string to the call: ?resource_type=droplet

curl -X GET "https://api.digitalocean.com/v2/snapshots?resource_type=droplet&page=1&per_page=100" \
    -H "Authorization: Bearer $TOKEN" \
    -H "Content-Type: application/json"

If you have automated backups enabled, they will also be shown.

It’s working as expected for me. So if you’re still experiencing issues, please go ahead and open a support ticket directly through the control panel. As they will be able to view the resources on your account, they should have better insight here.

Submit an Answer