Hi,
As there is no way to disable snapshot feature in grafana, for security reasons I was looking for deleting snapshots using APIs.
However, I see that for using delete API, we need the delete key . Can you please advise
If I create the snapshot from UI, how do I get the delete key for that snapshot?
Can I delete all snapshots in bulk using API ?
Thanks
dcech
January 4, 2019, 8:31pm
2
There are 2 api endpoints for deleting snapshots, one that uses the deleteKey and doesn’t require authentication, and another authenticated endpoint that can delete using the snapshot key.
You can get a list of snapshots , then delete each one using its key.
Thanks! So there is no API that can delete all snapshots in bulk ?
something like - DELETE community.grafana.com/api/snapshots/*
Also, could you please confirm that using authenticated endpoint as admin, I can delete snapshots created by any user ?
dcech
January 4, 2019, 9:25pm
4
Bulk deletion is not supported, if you are an admin you can delete snapshots from any user.
Thanks a lot. Is there any release plan to disable snapshot feature in UI?
dcech
January 4, 2019, 9:36pm
6
Not that I know of, you could block the api route in your reverse proxy, or use this PR that added support for disabling external snapshots as a guide to add another config variable to control local snapshots.
Could you please elaborate on how this can be done ?
dcech
January 4, 2019, 9:59pm
8
The front-end saves snapshots by POSTing to the api route /api/snapshots , so if you add a rule in your nginx/apache/etc config that just denies all POSTs to /api/snapshots then users will not be able to save snapshots.