How to import dashboard in grafana using REST API

I need to import the dashboard in the Grafana using rest API, Can anyone provide me the python working code?

Hi @avinashvermajava,

You can definitely do this by using popular scripts e.g. Python or Bash (or simply with cURL command).

As a starting point, please have a look at our API Documentation here.

There are already some community posts regarding this so you can check the following links

1- Import dashboard from file via API

2- Grafana API create dashboard API with Python

Also, I recently found this (haven’t known it before) that there are now Python library functions available to do that (in just a single command line);

1- grafana-import - Python Package Health Analysis | Snyk

2- grafanalib/grafanalib/tests/examples at main · weaveworks/grafanalib · GitHub (Scripts ready to go)

and if you really want to go a bit in more hands-on then you can check this link:

I hope this helps.