HTTP API for importing dashboard

  • What Grafana version and what operating system are you using? OSS 11.0, Ubuntu Container

  • What are you trying to achieve?
    I am trying to bring dashboard automatically from a json file using a REST API.

  • How are you trying to achieve it?

  • What happened?

  • What did you expect to happen?
    At the moment, I am looking for an API that takes json as input to some API that automatically imports it and brings up the dashboard. I am expecting some API similar to “api/dashboard/db”

  • 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.

  • Did you follow any online instructions? If so, what is the URL?

JSON could be imported by Grafana Infinity Datasource:

But not sure that it is possible at all to build a dashboard dynamically from JSON that you receive via API…

May be dashboard HTTP API will be of use:

I tried using Grafana HTTP API, this did not work for me.

I have scenario where I wish to bring up dashboard exported json file from UI. Steps below:

  • User creates or updates the dashboard using Grafana UI.
  • Exports the dashboard to a json file and dump into some “X” folder.
  • My script is monitoring “X” folder for changes and triggers a HTTP request with file path
    (json file path) to bring up dashboard from the file.

Note: It is kind of similar to Grafana Provisioning but I am specifically looking for a HTTP API

Use HTTP dashboard export API first - compare result file with that export result from UI: they are not identical, but they are similar. So your script must modify that exported file from UI, to match expected structure for HTTP import.

1 Like

This worked. I exported using export API and used the same JSON (with some changes as needed) with import API