-
What Grafana version and what operating system are you using?
v7.5.10 (e72061a129) -
What are you trying to achieve?
We are trying to retrieve all of the panel ids that are on a dashboard via the restful web service. -
How are you trying to achieve it?
Using HTTP API -
What happened?
-
What did you expect to happen?
-
Can you copy/paste the configuration(s) that you are having problems with?
-
Did you receive any errors in the Grafana UI or in related logs? If so, please tell us exactly what they were.
No -
Did you follow any online instructions? If so, what is the URL?
Hi @ddavismomemtum,
This ought to do it:
curl -s -H "Authorization: Bearer ${KEY}" \
"${YOUR-GRAFANA-URL}/api/dashboards/uid/${DASH-UID}" | \
jq '.dashboard.panels[].id'
I would also check out this much larger conversation about writing bash scripts to import export dashboard json.
Also, if you used a dashboards-as-code approach and checked your dashboards into version control, then you wouldn’t need to rely on the api
Thanks for the response. I think my main problem is that there is no id field in the result object.
Below is an example of the dashboard node of the return object. Panels does not seem to have an id field.
“dashboard”: {
“id”: 94,
“panels”: [
{
“dashLength”: 10,
“datasource”: “Graphite Remote”,
“description”: “west01.voip.evolveip.net”,
“gridPos”: {
“h”: 9,
“w”: 12,
“x”: 0,
“y”: 0
},
“lines”: true,
“linewidth”: 1,
“nullPointMode”: “connected”,
“targets”: [
{
“refId”: “A”,
“target”: “alias(dctnms01.west01.PING.rta, ‘Ping RTA’)”,
“textEditor”: false
}
],
“title”: “west01.voip.evolveip.net PING”,
“type”: “graph”,
“xaxis”: {
“buckets”: null,
“mode”: “time”,
“name”: null,
“show”: true,
“values”:
},
“yaxes”: [
{
“format”: “ms”,
“label”: “RTA”,
“logBase”: 1,
“max”: null,
“min”: null,
“show”: true
},
{
“format”: “short”,
“label”: null,
“logBase”: 1,
“max”: null,
“min”: null,
“show”: true
}
]
}
],
“tags”: [
“west01”,
“checkmk”,
“country: US”,
“carrier: Evolve-LasVegas-SBCs”,
“description: west01.voip.evolveip.net”
],
“time”: {
“from”: “now-6h”,
“to”: “now”
},
“timezone”: “browser”,
“title”: “west01.voip.evolveip.net”,
“uid”: “qWVHP27Mz”,
“version”: 1
}
@ddavismomemtum @mattabrams did you figure out why your panel id is missing? I am running to a similar issues with a graph panel not showing when running:
curl -s -H "Authorization: Bearer ${KEY}" \
"${YOUR-GRAFANA-URL}/api/dashboards/uid/${DASH-UID}" | \
jq '.dashboard.panels[].id'
but showing up in the json model.