2
votes

I was trying to import dashboard using exported json file from one server to another server of grafana, but getting bellow error;

{"message":"Dashboard not found","status":"not-found"}

My curl command:

  curl -X POST --insecure -H "Authorization: Bearer {API KEY}" -H "Content-Type: application/json" --data-binary @'{JSON file name}' http://{Host ip}:3000/api/dashboards/db

To export dashboard, I am using following curl command; curl -f -k -H "Authorization: Bearer {API key}" "http://{Host IP}:3000/api/dashboards/db/mydashboard" | jq 'del(.overwrite,.dashboard.version,.meta.created,.meta.createdBy,.meta.updated,.meta.updatedBy,.meta.expires,.meta.version)' > {JSON file name}"

  1. I am unable to find exact missing field OR value which is missing OR incorrectly passed through JSON file while importing. Is there any way to debug?
  2. Is there any issue with my Export and import command.
1
Now able to import grafana dashboard using json file. The issue was in the json file. Found solution on bellow link; community.grafana.com/t/…rajendra

1 Answers

3
votes

As mentioned in this issue,

you must replace the "id": num field of the dashboard with null.
so you can change it for all of your dashboards (.json files) by command below: (works with GNU sed only)

sed -i '0,/"id": .*/{s/"id": .*/"id": null,/}' *.json