Save snapshot to grafana database

I’ve reviewed the Grafana Snaspshot API and I don’t seem to understand how the create endpoint is intended to be used. I want to be able to use the endpoint to create a snapshot from anywhere, and have the snapshot saved to the server, which is how it appears to work if I create snapshot from the frontend UI and do “local snapshot”.

I’ve tried with and without including this in my json:

"external": true,
"key": "1234",
"deleteKey": "lol"

When I hit the endpoint from my workstation, I’ll get a url returned like this: “https://localhost:443/dashboard/snapshot/1234”, which of course doesn’t exist.

How can I hit this endpoint and have the snapshot properly saved to my grafana server, like it does when I go to create from the UI?

Creating a snapshot via the api is unfortunately very hard to use externally. The problem is that the snapshot data is saved in the dashboard json on the Grafana frontend and then the dashboard json with the embedded snapshot data is sent to the api. Basically, you need the Grafana frontend to generate a snapshot. The API just saves the result.

It is on our TODO list to make a better API for snapshotting that uses headless chrome to be able to do a server side render of a panel.

See this issue for some possible workarounds: