Snapshots API should list only snapshots?

June 28, 2017 651 views
API Debian

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.

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.

  • It's show 64 of them after apply resource_type=droplet which still not right for me, Thanks anyway.

Have another answer? Share your knowledge.