Is there a supported way to access the dashboard json and upload a changed version?

Hi all

Some years back, I used to download the dashboard json and edit and return it with changes to the server with the API. I also experimented with copying and pasting from the Grafana web UI in
Settings ⚙️ 👉JSON Model.

Issues that I could not solve were clashes with uid and version.
Is there a documented way to do it in the way I want and safely, robustly?

Why not edit directly in the UI?
Its cramped, awkward and in the end not a win for my workflow than jsut using the mouse and clicker UI.

Thanks for any directions on this as I would love to be able to have the option of editing the dashboard json in my favourite environment.

Hey, and thanks for Grafana

E

I have no idea about documentation for this, but I have done exactly the same
thing; created a dashboard manually, downloaded the JSON, and then scripted
changes to that for similar but not identical deployments. I then copy the
resultant JSON file to the path specified in Grafana’s dashboard.yaml file and
reload.

In terms of uid and version, I ensure that uid is unique to the dashboard on
that server (ie: several dashboards on one Grafana instance must have different
uids from each other, but I do not change the uid between versions of the same
dashboard), and I simply increment the version number between updates of each
dashboard. Version numbers have no relationship between different dashboards,
but a new version of a dashboard must have a higher (ie: numerically bigger)
version number than the one it is replacing. The difference doesn’t have to be
precisely one, though - just so long as the new number is bigger than the old
one.

I hope that helps,

Antony.

1 Like

Thanks a lot for sharing your careful approach Anthony.
When I get down to this, I will follow that and see if I experience more robustness than my experiences when I last braved this. Hopefully it “just works”

I will report back, if anyone else has some nice methodologies or even some scripting for this, that would be nice too :slight_smile:

My best
E

if you use provisiong you could do what you want

1 Like

Use Grafana dashboard API. BTW: UI uses API as well, so you can use browser console to watch API requests from UI in real life - you will have idea about API endpoints and payloads without reading Grafana API doc. There is also swagger UI, which may help you to develop API queries.

1 Like

Yes! Would love to succeed provisioning, very elegant.
I also tried this some years ago and stumbled.
Is there any QuickStart guidance that you can share on this.

Following Grafana docs for me are often not great experiences :face_with_hand_over_mouth:
(Another plus one for the comment above from @jangaraj )

check out the provisioning folder for a sample.yaml

but make sure you try things out in a fresh install of grafana locally so as not blow away working dashboards

1 Like

see this

1 Like