Need to create panel JSON via an external program

I have a bunch of data that I’d like to use perl (I’m old - get off my lawn) to build dashboards for. the JSON seems pretty straight forward except for the “id” variable. It looks like each dashboard has an id, and each graph in a dashboard has sequential id.

If I export a dashboard, I can see an id number for the dashboard, and ids for the graphs. I assume when a dashboard is imported, the dashboard id in the JSON is ignored, and a new one generated.

Is all this correct?

1 Like

This assumption is incorrect. You need to remove the id before importing otherwise it will try to overwrite an existing dashboard with that id. The panel ids are sequential as you noted and should not be removed.

So if I remove the id, new ids will be generated on import?

Yes, exactly. Grafana will try to extract the id from the json if it exists otherwise it save it as a new dashboard with a new id.